Developer

Regex tester

Try a JavaScript regular expression and list the matches.

Loading tool…

  1. 1 Enter the pattern without surrounding slashes.
  2. 2 Add flags such as i or m.
  3. 3 Paste a short sample.
  4. 4 Read the matches or the syntax error.

How it works

Enter a pattern, optional flags, and a sample string. The page builds a JavaScript RegExp and lists matches, including capture groups. The global flag is added when it is missing so more than one match can be shown. A pattern that is too large, or a sample over 20,000 characters, is rejected. Catastrophic backtracking can still freeze a tab; keep samples short.

Frequently asked questions

Which regex flavour is this?

JavaScript. Lookbehind and other features follow your current browser, which may differ from Python or PCRE.

Why was the global flag added?

Without g, a search stops at the first match. The tester adds g so the list can show later matches. Your flags are still shown.