Skip to content

Regex Tester

Test JavaScript regular expressions live

//g
Patterns
Test string0 matches
Matches

Enter a pattern to see matches.

Quick reference
.Any character except newline
\d \w \sDigit, word character, whitespace (uppercase negates)
^ $Start / end of input (or line with m)
* + ?Zero or more, one or more, optional
{n,m}Between n and m repetitions
(abc)Capturing group
(?<name>abc)Named capturing group
(?:abc)Non-capturing group
a|bAlternation
[a-z]Character class
(?=x) (?!x)Lookahead / negative lookahead
(?<=x) (?<!x)Lookbehind / negative lookbehind
\bWord boundary
*? +?Lazy quantifiers

How to use

  1. Type a pattern between the slashes and toggle flags such as g (all matches) or i (ignore case).
  2. Paste the text to test. Matches are highlighted and listed with their capture groups.
  3. Open Replace to preview a replacement using $1 or $<name> references.

Testing JavaScript regular expressions

The tester runs your pattern with the browser's RegExp engine, so what works here works in your JavaScript and TypeScript code. Start from a common pattern, refine it while watching the highlights update, then copy the pattern and flags into your project.

Frequently asked questions

JavaScript (ECMAScript) regular expressions, exactly as used by the RegExp class in browsers and Node.js, including named groups, lookbehind and Unicode mode.