Ready now
Regex Tester
Preparing controls…
About this tool
What Regex Tester does
Test a JavaScript regular expression against local text and inspect bounded match results without sending the pattern anywhere.
Run a JavaScript regular expression against test text in a terminable browser worker. Inspect each match, its zero-based index and capture groups without sending the pattern to a server.
Capture two numeric suffixes
Input or settings
Pattern: item-(\d+) Flags: g Text: item-42 item-7
Expected result
Match "item-42" at index 0; group 1 = "42" Match "item-7" at index 8; group 1 = "7"
How to use it
- Enter the pattern without enclosing slash delimiters and choose JavaScript flags.
- Paste test text, then choose Test expression.
- Inspect match indices and groups; simplify the expression if the worker times out.
Common uses
- Check a capture group before using it in a JavaScript parser.
- Investigate why a pattern matches part of a value instead of the complete value.
Important limitations
- JavaScript semantics can differ from PCRE, RE2, Python or .NET.
- The worker is limited to one second and bounded input/match counts. A timeout means the pattern needs simplifying, not that the text contains no matches.
Frequently asked questions
Why is the first index zero?
JavaScript match indices are zero-based UTF-16 positions. An emoji can occupy two code units even when it looks like one character.
Why does a pattern from another engine fail?
Regular-expression syntax and flags vary. Remove slash delimiters, use JavaScript-compatible syntax and check the supported flags.