Regex Tester

Test regular expressions with live highlighting and groups.

Loading the interactive tool… It runs in your browser — if it doesn't appear, enable JavaScript.

Type a pattern and a test string; matches highlight live, capture groups display per match, and syntax errors report immediately instead of silently matching nothing. Uses JavaScript's regex engine — the flavor that actually runs in browsers and Node — so what works here works in your code. Zero-length-match traps and runaway global loops are handled for you.

Frequently asked questions

Why does my pattern work here but not in my code?

Usually escaping: inside a JavaScript string literal, every backslash must be doubled ("\\d" for \d). Regex literals (/\d+/g) avoid that. Also check the flags — this tester shows exactly which are active.

What do the g, i, m and s flags do?

g finds all matches instead of stopping at the first; i ignores case; m makes ^ and $ match per line rather than per string; s lets the dot match newlines. The tester applies them live so you can see each one's effect.

Is this the same regex syntax as Python or grep?

Close but not identical — this is JavaScript (ECMAScript) flavor. Most patterns transfer, but lookbehind support, named groups syntax and character class details differ across engines. Test in the engine you'll deploy.