Free Regex Tester
Try JavaScript regular expressions against sample text, inspect matches and capture groups, and catch invalid patterns. Nothing is uploaded.
Enter a pattern and sample text, then select Test regex.
Matches and capture groups
Safety: Pattern matching runs in an isolated worker and is stopped if it takes too long. Results are limited to 100 matches. Regex behavior follows the browser's JavaScript engine; review patterns before using them in production.
JavaScript regular expression examples
Enter a pattern without the surrounding slash characters, then set flags separately. For example, \\bcat\\b with the gi flags finds whole-word occurrences of “cat” regardless of case.
Useful starter patterns
\\d+— one or more digits.^[A-Z]{2,5}$— two to five uppercase letters across the entire input.\\b(error|warning)\\b— the words “error” or “warning”.^.{0,20}$— a line with zero to twenty characters (subject to JavaScript dot and newline behavior).
Common regex troubleshooting
- Use
^and$when you need to match the whole input, not just a substring. - The
gflag finds multiple matches; theiflag ignores case. - Escape special characters such as a literal dot with
\\.. - Regex is not a complete validator for complex formats such as all valid email addresses or URLs.
Frequently asked questions
Does this use JavaScript regex syntax?
Yes. Patterns are evaluated by the browser's JavaScript regular-expression engine, so support for newer flags can vary by browser.
Why are there no results?
Check the spelling of the pattern, the flags, and whether the sample text contains a match. Invalid patterns will show an error.