Free · No sign-up · Private

Regex Tester

Test a regular expression against text and see all matches highlighted.

Quick answer

Enter a pattern, its flags and some test text, and every match is highlighted as you type, with its position and capture groups listed below. The pattern \b\w+ing\b with flags gi finds “Running”, “swimming” and “coding” in the sample sentence.

Regex TesterRuns in your browser
3 matches

Running and swimming are fun. I love coding.

Match details
  • #1: “Running” at 0
  • #2: “swimming” at 12
  • #3: “coding” at 37

Step by step

How to use the Regex Tester

01

Enter a pattern and flags.

02

Enter test text.

03

See matches and groups.

Worked examples

Regex cheat sheet

PatternMatches
\dA digit
\wA letter, digit or underscore
\sWhitespace
^ and $Start and end of text (or line with m)
a+ / a* / a?One or more / zero or more / optional
(abc)Capture group
[a-z]Any lowercase letter

Good to know

Flags

g finds every match instead of the first, i ignores case, m makes ^ and $ work per line, s lets . match line breaks, u enables full Unicode and y matches only at the current position.

JavaScript flavour

Patterns run on your browser’s JavaScript engine. Most syntax is shared with Python, PHP and Java, but features such as lookbehind and named groups can behave differently in other languages.

FAQ

Frequently asked questions

Why does my pattern only find one match?

Add the g flag to find all matches.

How do I match a dot or a bracket literally?

Escape it with a backslash: \. or \(.