Regex Tester
Find JavaScript regex matches safely.
How to use Regex Tester
Enter a JavaScript regular expression without slash delimiters, set flags, and paste your test text. Results include match positions and capture groups.
Good to know
Expressions run in a separate worker with a timeout. Extremely expensive patterns are stopped. Match output is capped at 1,000 results. Positions use JavaScript string offsets.
Extract numbers from a log message
Choose Test to try this example using the pattern, flags, and text shown below.
Input
Pattern: (\d+) Flags: g Text: job 42 finished in 150 ms
Expected result
Match 1: "42" at index 4; capture group "42" Match 2: "150" at index 19; capture group "150"
Common questions and mistakes
Why do I only get the first match?
Add the g flag to find repeated matches. Enter the expression itself, such as \d+, without surrounding / characters. Use i for case-insensitive matching and m when ^ and $ should match line boundaries. Flags cannot be repeated.
Will this pattern work in Java or Python?
Not necessarily. This tester uses your browser’s JavaScript regular-expression engine. Escaping, Unicode behavior, and supported syntax can differ across languages and browser versions. Test in your target runtime before relying on the pattern. Expensive expressions are stopped after five seconds.
Related tools
- JSON Formatter — Format, validate, and minify JSON.
- URL Encoder / Decoder — Encode or decode a URL component.