Regular Expression Tester

Test JavaScript regular expressions in your browser. Find matches, numbered and named capture groups, and match positions. Try global, case-insensitive and multiline flags.

Test
0 characters
Result

Your result will appear here.

How to test a regular expression

  1. Paste the text you want to search into the input field.
  2. Enter the pattern without enclosing / delimiters. Put flags such as g or gi in the flags field.
  3. Run the test and review each match, its positions and capture groups. Edit the pattern or flags and test again.

Working with Regular Expression Tester

The engine uses JavaScript regex syntax, not PCRE or Python syntax. Positions are UTF-16 offsets, as in JavaScript. Matching runs in a separate worker with a hard timeout, so catastrophic backtracking can be cancelled.

Extracting codes and numbers with capture groups

Input
Input AU-42 NZ-7 Regular expression (?<code>[A-Z]{2})-(\d+) Flags g
Result
{ "matches": [ { "value": "AU-42", "index": 0, "end": 5, "captures": [ "AU", "42" ], "groups": { "code": "AU" } }, { "value": "NZ-7", "index": 6, "end": 10, "captures": [ "NZ", "7" ], "groups": { "code": "NZ" } } ], "truncated": false }

Questions about Regular Expression Tester

Should I enter /pattern/g or just the pattern?

Enter the pattern itself, such as (?<code>[A-Z]{2})-(\d+), and enter g separately as a flag. Do not add JavaScript string quotes or double backslashes as you would in source code. This uses your browser’s JavaScript RegExp engine, not Python, PCRE or .NET; syntax and support can differ.

What do g, i, m, s, u, v and y mean?

g searches for multiple non-overlapping matches; i ignores letter case; m makes ^ and $ work at line boundaries; s lets . match line terminators. u and v enable Unicode-aware modes and cannot be combined. y requires the next match to start exactly at the current position. Newer flags depend on browser support.

How do capture groups and match positions work?

(…) captures by number, while (?<name>…) also gives the group a name. An unmatched optional group is reported as null. Positions start at zero; the end position is exclusive. Like JavaScript, offsets count UTF-16 units, not visible characters: an emoji may occupy two. Zero-width matches have identical start and end positions.

Why are there no matches, or why does the test stop?

Check the pattern, flags, line breaks and letter case. Without g or y, the tool returns only the first match. It shows at most 1,000 matches and marks truncated results. Large inputs or expensive backtracking can trigger size or time limits; the browser worker is stopped rather than leaving the page frozen. Try a smaller sample or simplify nested quantifiers.

Are my files, tokens or text uploaded?

No. These tools process your input in your browser. The website serves the page and its code, but your input is not sent to a conversion server or saved in an account.

Common tasks and examples

  • JSON Minifier

    Compact JSON to one line while keeping string contents and exact numbers.

Explore all developer tools

Encoding & Files

Move between text, bytes, URLs and embedded images without changing your original data.

Data & Text Inspection

Read structured data, inspect tokens and understand exactly what changed.

Hashes, IDs & Schedules

Check file integrity, generate identifiers and make sense of times and recurring schedules.

Your input and files are processed on your device. Keep sensitive results out of shared clipboards and use a trusted device for private keys and tokens.