gukbap-tools

Regex Tester

Test regular expressions live

//g

JavaScript (ECMAScript) regular expression syntax.

Regex cheat sheet
SyntaxMeaningExample
\dAny digit\d{3} → 010
\wLetter, digit or underscore\w+ → hello_1
\sWhitespacea\sb → a b
.Any character except a newlinea.c → abc
^Start of the string (or line)^abc
$End of the string (or line)abc$
[abc]Any one character in the brackets[aeiou]
[^abc]Any character not in the brackets[^0-9]
(group)Capture group(\d+)-(\d+)
(?<name>...)Named capture group(?<year>\d{4})
a|ba or bcat|dog
?Zero or onecolou?r
+One or morea+
*Zero or morea*
{n,m}Between n and m times\d{2,4}
(?=...)Lookahead (followed by …)\d+(?= USD)
(?!...)Negative lookahead (not followed by …)\d+(?! USD)
\bWord boundary\bcat\b

Test a regular expression against your text and see every match highlighted as you type, with capture groups listed. A free online regex tester with flag toggles that runs in your browser.

How to use

  1. Enter your regular expression and turn on the flags you need (g, i, m…).
  2. Paste the text to test against — matches are highlighted as you type.
  3. Check the match list to see each result and its capture groups.

FAQ

Q. Which regex flavor is used?
A. JavaScript (ECMAScript) regular expressions, the same engine your browser and Node.js use.
Q. Why does my pattern only match once?
A. Turn on the global (g) flag. Without it the engine stops after the first match.
Q. Are capture groups shown?
A. Yes. Each match lists its numbered capture groups, so you can confirm the parts you intend to extract.

Spotted something wrong? Let us know.