The regex tester that explains, lints, and ships code with you.
Supports native replacement syntax: $1, $<name>, $&, $`, $'.
Static analysis of your pattern — catches common mistakes and performance footguns, with one-click fixes where it's safe to apply one automatically.
Ready-to-paste snippets for the pattern above, in six languages — flags and replacement syntax are translated per language.
Give a few strings that should match and (optionally) a few that shouldn't — this builds a best-effort pattern from them. It's a heuristic, not a guaranteed-general solution, so always check the results below and try it in the Matches tab.
Click any card to load it straight into the tester, with a matching sample test string.
Anchors
^Start of string / line$End of string / line\bWord boundary\BNot a word boundaryCharacter classes
.Any character except line break\d \DDigit / non-digit\w \WWord / non-word character\s \SWhitespace / non-whitespace[abc]Any of a, b, or c[^abc]Any character except a, b, c[a-z]Any character in the range a–zQuantifiers
*0 or more+1 or more?0 or 1 (optional){n}Exactly n times{n,}n or more times{n,m}Between n and m times*? +?Lazy (as few as possible)Groups & alternation
(...)Capturing group(?:...)Non-capturing group(?<name>...)Named capturing groupa|ba OR b\1 \k<name>BackreferenceLookaround
(?=...)Positive lookahead(?!...)Negative lookahead(?<=...)Positive lookbehind(?<!...)Negative lookbehindFlags
gGlobal — find all matchesiCase-insensitivemMultilinesDot matches newlineuUnicode modeySticky