Explore
Open navigation menu
Developer Tools
Free tool

Regex Tester

Run a regular expression against sample text in your browser and inspect every match locally.

No account needed · Processed in your browser

Your data stays in your browser. Nothing is uploaded or saved.

JavaScript syntax; indexes count UTF-16 code units. Ctrl/Cmd + Enter runs the test. Execution stops after 1 second; results are limited to 1,000 matches and input to 1 MiB.

How to test a regular expression

The JavaScript engine checks your text in an isolated worker.

1

Enter a pattern

Write the expression without slash delimiters and choose flags.

2

Add test text

Paste a sample into the editor; Ctrl/Cmd + Enter runs the test.

3

Inspect matches

Check indexes, text and capture groups, or fix the reported error.

Understand the matches

Test JavaScript regular expressions against sample text locally. The tool shows every match and its capture groups without sending your pattern or text to a server.

Use it while writing a JavaScript pattern, checking a validation rule or investigating why a pattern matches too much or too little. Enter the pattern without surrounding slashes, choose only the flags you need, and paste representative sample text.

Pattern, flags and text

The JavaScript engine applies the pattern and flags to your sample. The g flag finds all matches; without it, the first match is returned.

Practical example

To find capitalised words, test \b([A-Z][a-z]+)\b with the g flag against Ada wrote code with Linus. The full matches are Ada and Linus, and capture group 1 contains each name.

The engine limits execution time and match count.

How to read the results

Each result reports the matched text and its position. Numbered and named capture groups are listed with the match so you can verify which part of the pattern captured each value. A valid pattern with no results is different from an invalid pattern: no match is a legitimate outcome, while syntax errors are reported before execution.

Limits and edge cases

  • Patterns use the JavaScript regular-expression syntax supported by your browser.
  • Match positions use JavaScript UTF-16 indices, which can differ from visible character counts for some emoji and combined characters.
  • Execution is isolated and stopped after one second. Output is capped at 1,000 matches and input at 1 MiB.
  • Test realistic examples and non-matching input; a successful sample does not prove a pattern is safe or correct for every value.

For adjacent developer tasks, use the JSON Formatter & Validator, Unix Timestamp Converter or UUID & ULID Generator.

Other developer tools

View all

Frequently asked questions

What does zero matches mean?

The pattern is valid, but it does not match the selected text and flags.

Is my text uploaded?

No. Testing runs locally in your browser.