Regex Tester
Test JavaScript regular expressions with live match highlighting, flags and capture groups.
Privacy: This tool runs entirely in your browser. Your data never leaves your device and is never uploaded to any server.
How to use this regex tester
- Type your pattern and the text you want to test it against.
- Matches are highlighted as you type.
- Toggle flags to change how the pattern behaves.
- Everything runs locally in your browser.
Patterns worth keeping
A few regular expressions come up again and again. These are worth checking against your own input rather than copying blindly.
| Pattern | Matches |
|---|---|
| ^\d{5}$ | Exactly five digits, such as a US ZIP code |
| ^\d{4}-\d{2}-\d{2}$ | An ISO date such as 2026-10-13 |
| ^https?:// | A URL that starts with http or https |
| ^[^@\s]+@[^@\s]+\.[^@\s]+$ | A simple email shape, but not full RFC compliance |
| \bword\b | The whole word, not part of a longer one |
| ^(?!.*\bTODO\b).*$ | Lines that do not contain TODO |
What the flags do
- g — global. Find every match instead of stopping at the first.
- i — case insensitive.
- m — multiline. ^ and $ match the start and end of each line.
- s — dotAll. A dot also matches newlines.
- u — unicode. Treat the pattern as code points rather than UTF-16 units.
Watch out for catastrophic backtracking
A pattern that nests quantifiers, such as (a+)+b, can take exponential time to fail on the wrong input.
The regex looks instantaneous on your test string and then freezes a production server. Test with a long, non-matching input before shipping anything with nested repetition.
Test the edges, not the happy path
- Empty string, and a string of only whitespace.
- Input that is far longer than anything you expect.
- Unicode and emoji, if the field accepts them.
- The string one character short of matching.
Which flavour of regex is this
The tester uses the JavaScript engine, the same one in browsers and Node.
Flavours differ in detail. Lookahead is supported, lookbehind depends on the runtime, and Python and PCRE have syntax that will not work unchanged here.
Frequently asked questions
Which flavor of regex is used?
JavaScript regular expressions, the same engine used in browsers and Node.js.
What flags are supported?
Global, ignore-case, multiline, dotAll and unicode flags.
Is the input sent anywhere?
No. Matching runs locally in your browser.
Why does my pattern match more than I expected?
Greedy quantifiers such as .* consume as much as they can. Add a question mark (.*?) to make them lazy, or anchor the pattern with ^ and $.
How do I match across multiple lines?
Turn on the dotAll flag so that . also matches newlines, or use [\s\S] instead of the dot, which works in any JavaScript version.
What is the difference between test and match?
test returns a boolean, while match returns the matched text and its capture groups. This tester highlights the matches so you can see both at once.
More Text tools
Text Diff Compare
Compare two blocks of text line by line and see exactly what was added and removed.
Text Case Converter
Convert text between UPPERCASE, lowercase, Title, camelCase, snake_case, kebab-case, slug and more.
Markdown Editor
Write Markdown and preview the rendered HTML live, entirely in your browser.
Lorem Ipsum Generator
Generate placeholder text by paragraph, sentence or word, ready to paste into a design or template.
Word & Character Counter
Count words, characters, sentences and paragraphs as you type, with an estimate of reading time.