UtilityPilot.Find a tool

Developer Tools

Regex Tester

Run a JavaScript regular expression against test text. Inspect each match, numbered and named capture groups, and zero-based positions before using the pattern in your own code.

Processed in your browserPrivacy details ↗

256 KiB test text · 4 KiB pattern · 1,000 matches · 8-second timeout

Adjust your options

No sign-up. No upload.

How to test a regular expression

  1. Paste a representative sample into Test text.
  2. Enter the pattern without surrounding slash delimiters. For digits, type \d+, not a quoted JavaScript string.
  3. Choose flags in the Flags field, such as g for repeated matches or gi for repeated case-insensitive matches.
  4. Select Test regex and inspect the JSON result. Revise the sample or pattern and run again.
  5. Copy or download the report if you need to retain the matches and capture groups.

Supported flags and regex engine

The tool uses the browser’s JavaScript RegExp engine. It does not emulate Python, PCRE, .NET or Java. A pattern accepted by another engine can fail here, and a working JavaScript pattern still needs testing in its destination runtime.

  • g continues through successive matches.
  • i changes case matching; m changes line-anchor behavior.
  • s lets a dot match line terminators.
  • u enables Unicode-aware pattern interpretation.
  • y requires the next match at the current position rather than searching ahead.
  • d includes start/end indices for capture groups when supported by the browser.

Each flag can appear once. Without g or y, the report contains at most the first match. Empty test text and an empty pattern are legitimate regex inputs and may produce an empty match.

Understanding matches and capture groups

Each match contains its text, start and exclusive end position, numbered groups and named groups. Unmatched optional groups become null, which differs from a group that matched an empty string. The complete match is separate from the numbered capture list.

Positions count UTF-16 code units, as JavaScript does. A non-BMP symbol such as many emoji occupies two code units even when it looks like one character. The Unicode flag changes pattern behavior but does not change the units used by the reported positions. For empty global matches, the tool advances one code point in Unicode mode or one code unit otherwise to avoid an endless loop.

A regex capture example

Input

Text: Order A-12, order B-34.
Pattern: (?<code>[A-Z])-(\d+)
Flags: g

Result

Match A-12: start 6, end 10; groups ["A", "12"]
Match B-34: start 18, end 22; groups ["B", "34"]

Both matches have a named code group as well as numbered groups. To test a validator, include examples that should fail: a missing number, extra punctuation and an unexpected newline. Matching a substring alone does not prove that the entire input follows a format.

Errors, long-running patterns and limits

Invalid syntax produces a readable error rather than a stack trace. Nested repetition can take a long time even on modest text. Execution runs in a disposable worker, with Cancel and an eight-second timeout so a slow pattern can be stopped without running it on the page’s main thread. This is a responsiveness measure, not a claim that every expression is fast.

Input is limited to 256 KiB, pattern bytes to 4 KiB and reports to 1,000 matches. A truncated report is marked explicitly. Narrow the sample before expanding it. No replacement code, user JavaScript or AI-generated expression is executed. Use literal Find and Replace for a known fixed string, or Text Diff to inspect edits. The text counter explains different character units.

Processing and privacy

The operation runs in your browser. The tool does not send the material you enter to a processing server or automatically save it. Reset clears the form and result from the interface; it is not a secure-erasure guarantee for browser memory. Copy and download deliberately create copies outside the tool. The website itself still makes ordinary requests for its pages and scripts. See the privacy policy for the distinction.

Frequently asked questions

Should I include /pattern/g?

No. Enter the pattern itself in the pattern field and g in Flags. Slash delimiters belong to JavaScript source syntax.

Why does the tester stop after one match?

Without g or y, JavaScript execution returns the first match only. Add g to search for successive matches.

Does this validate an email address or URL completely?

Only if your pattern implements the rules you need. A matching substring is not delivery, ownership or standards validation.