Regex Tester

Test regular expressions against sample text with live match highlighting and capture groups.

Test text

About the Regex Tester

This regex tester runs your pattern against sample text as you type, using the same JavaScript regular expression engine that runs in every browser and in Node.js. Matches are highlighted directly in the text, and capture groups, both numbered and named, are laid out in a table so you can confirm each group captures exactly what you expect.

Use it to build a pattern step by step before committing it to code, to debug a regex that matches too much or too little, or to check how a pattern behaves against edge cases like empty lines, unicode characters, or unusual spacing. Because the engine is the real one used by JavaScript, what works here works in your code.

Quick reference

  • . any character except newline, \d digit, \w word character, \s whitespace
  • * zero or more, + one or more, ? optional, {n,m} between n and m times
  • ^ start of line, $ end of line, \b word boundary
  • (abc) capture group, (?:abc) non capturing group, (?<name>abc) named group
  • [abc] character set, [^abc] negated set, a|b alternation
  • (?=abc) lookahead, (?!abc) negative lookahead, (?<=abc) lookbehind

Your pattern and test text stay in your browser. Nothing is uploaded, so it is safe to test against logs, user data, or anything else you would not paste into a random website.

Your ad could be here

Reach developers and designers who use these tools every day. Privacy-first, no trackers.

Frequently asked questions

Which regex engine does this tool use?

The JavaScript engine built into your browser. It is the same engine used by Node.js and browser code, so patterns that work here behave identically in JavaScript projects. Syntax from other engines, like PCRE recursion or possessive quantifiers, is not supported because JavaScript does not support it.

What do the flags mean?

g finds every match instead of stopping at the first. i ignores case. m makes ^ and $ match at line breaks instead of only the start and end of the whole text. s lets the dot match newline characters. u enables full unicode handling for characters outside the basic range.

Why does my pattern match nothing?

Check whether special characters need escaping. Characters like . + * ? ( ) [ ] { } | ^ $ and \ have special meaning and must be escaped with a backslash to match literally. Also confirm the case matches or enable the i flag.

What are capture groups?

Parentheses in a pattern capture the part of the match inside them, numbered from left to right starting at 1. Named groups, written (?<name>...), let you refer to the captured text by name. The groups table shows what each group captured for every match.

Is my test data sent anywhere?

No. The pattern and the text are processed entirely in your browser. This page makes no network requests with your input, so testing against sensitive data is safe.