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.
Running and swimming are fun. I love coding.
- #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
| Pattern | Matches |
|---|---|
| \d | A digit |
| \w | A letter, digit or underscore |
| \s | Whitespace |
| ^ 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 \(.
More developer tools
Related tools
JSON Formatter
Beautify JSON with configurable indentation and copy the formatted result.
Open toolJSON Validator
Validate JSON and pinpoint syntax errors with a friendly message.
Open toolJSON Minifier
Minify JSON by removing all whitespace for the smallest possible size.
Open toolBase64 Encoder
Encode text into a Base64 string for safe transport.
Open tool