Regex Tester
Test a JavaScript regular expression against your text. Inspect highlighted matches and capture groups, then copy or download the results.
Enter a pattern and text, or load an example.
Test text
Up to 50,000 UTF-16 units. Empty text and an empty pattern are valid inputs.
Highlighted matches
Run the current pattern to see matches.
Yellow highlights show full matches. A │ marker represents a zero-length match. Offsets are zero-based UTF-16 positions; [start, end) excludes the end position.
Matches & capture groups
Expand a match to inspect numbered and named groups. Unmatched optional groups show “Not participating”; a captured empty string is labeled separately. Details show up to 50 matches and 20 groups of each type, with long values shortened. Reports contain every retained match and its full values.
Using Regex Tester
Test JavaScript regular expressions against sample text and inspect the full matches and capture groups. Processing runs locally in a worker.
- Enter a pattern without slash delimiters or JavaScript string quotes, then paste test text or load an example. Write backslashes directly, such as \d.
- Choose g for all matches, i for case-insensitive matching, m for line anchors, s for dot matching newlines or u for Unicode mode. Click Run test.
- Review highlighted matches and expand a match for capture groups. Copy or download the JSON report. Edit inputs and run again to replace the results.
Example
Pattern: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})
Text: Dates: 2026-10-02 and 2025-12-31.
With g enabled, two matches expose year, month and day groups. This pattern extracts date parts; it does not validate calendar dates.Questions & answers
Which regex engine does this use?
It uses your browser’s JavaScript RegExp engine. Supported syntax can differ from PCRE, Python, Java and other engines, and newer features depend on browser support.
Should I include slash delimiters or double backslashes?
No. Enter the pattern itself, without /pattern/flags or JavaScript string quotes. Write \d directly rather than \\d; flags have separate checkboxes. Literal slashes can be part of the pattern.
What do g, i, m, s and u do?
g finds successive non-overlapping matches; without it, the tester returns only the first match. i ignores case. m lets ^ and $ act at line boundaries. s lets dot match newline characters. u enables Unicode-aware parsing and matching.
What are the displayed positions?
Offsets are zero-based UTF-16 indices, matching JavaScript string positions. The range [start, end) includes start and excludes end. Some emoji use two UTF-16 units even when they appear as one symbol.
Why do some matches have no visible text?
Patterns such as anchors and lookaheads can match a position without consuming text. They appear as a colored vertical marker. Global iteration advances after zero-length matches to avoid an infinite loop, respecting surrogate pairs in Unicode mode.
How are missing and empty capture groups shown?
An optional group that did not participate is shown as Not participating and exported as null. A participating group that captured no characters is labeled Empty string and exported as an empty string. Named groups are also listed separately.
Why can a test stop early?
A local worker is terminated after two seconds. Patterns are limited to 2,000 UTF-16 units and test text to 50,000. Results stop at 500 matches or 250,000 serialized match characters. A limit notice means more matches may exist; it is not a full match count.
Are patterns and test text uploaded or saved?
No. The tool keeps inputs and results in page memory and processes them locally. Inputs changing clears old results. JSON reports contain the pattern, flags and retained full matches/groups; details on the page show only the first 50 matches and 20 groups per type, with long values shortened.
Help improve this tool
Report a problem or suggest an improvement
Describe the issue without pasting private tool input. Feedback goes to our admin inbox.
