Regex Tester
Write a regular expression and see its matches in your text right away, with groups, positions and a replace preview.
Runs in your browser · No uploads
Match details
| # | Position | Match | Groups |
|---|
/…/g
Quick reference
| Write | Matches |
|---|---|
| . | any character except a line break |
| \d \w \s | a digit, a word character (letter, digit, _), a space |
| \D \W \S | anything but those |
| [abc] [^abc] [a-z] | one of, none of, a range |
| ^ $ | start and end of the text (or of each line with m) |
| \b | a word boundary |
| a* a+ a? | 0 or more, 1 or more, 0 or 1 |
| a{3} a{2,5} a{2,} | exactly 3, 2 to 5, 2 or more |
| a*? a+? | as few as possible (lazy) |
| (abc) (?<name>abc) | a group, a named group |
| (?:abc) | a group that isn't captured |
| a|b | a or b |
| (?=a) (?!a) | followed by a, not followed by a |
| (?<=a) (?<!a) | preceded by a, not preceded by a |
| \. \* \( | a literal . * ( (escape special characters with \) |
This tester uses your browser's own JavaScript engine, so it behaves exactly like regular expressions in JavaScript. Other languages (PCRE, Python, Java) differ in some details.
Your browser is too old to run this tool. Please update it, or use a current version of Chrome, Edge, Firefox or Safari.
- Nothing leaves your device
- No server-imposed size limits
- No sign-up, no watermark
- Free
How to test a regular expression
- Type the pattern between the slashes and choose flags such as g (all matches) or i (ignore case).
- Paste the text to search. Matches are highlighted as you type.
- Check the groups in the table, and try a replacement such as $1 or $<name>.
Safe to experiment
Each pattern runs with a two-second time limit, so a pattern that never finishes (catastrophic backtracking, such as (a+)+$) is stopped instead of freezing the page.
Which flavour?
This is your browser's JavaScript engine, so results are exactly what JavaScript code will do. PCRE (PHP), Python and Java mostly agree but differ in details such as lookbehind support, Unicode classes and replacement syntax.
Frequently asked questions
Why does my pattern only find one match?
Turn on the g flag to find every match; without it, only the first is found.
Is my text uploaded?
No. Everything happens in your browser, and the page is blocked from uploading anything.
Guides for this tool
-
Regular Expressions for Beginners: A Practical Regex Cheat Sheet
Learn the regex building blocks (characters, classes, quantifiers, anchors, groups) with practical examples you can test live, from emails…
Related tools
-
Find and replace text
Find and replace words in text, with optional match case, whole words or regular expressions. -
Extract emails and links
Pull email addresses, links, phone numbers, hashtags or IP addresses out of any text. -
Format JavaScript
Beautify minified or messy JavaScript with consistent indentation. -
Validate JSON
Check if JSON is valid and find the exact error position.