Add to my tools
Press Ctrl + D to bookmark Regex Tester.
Open your browser menu (⋮ or the share icon) and tap Bookmark or Add to Home Screen.
Regex Tester
Test, debug, and visualize regular expressions in real-time.
Error:
Pattern
Test String
Matches:
Results
No matches found. Enter a pattern and test string above.
Match
Index:
Groups:
$:
Matches:
Groups:
Pattern: chars
Regex Cheat Sheet
Character Classes
.Any character\dDigit [0-9]\wWord char\sWhitespace[abc]a, b, or c[^abc]Not a, b, c
Anchors
^Start of string$End of string\bWord boundary\BNot word boundary
Quantifiers
*0 or more+1 or more?0 or 1{n}Exactly n{n,}n or more{n,m}Between n and m
Groups
(abc)Capture group(?:abc)Non-capture(?=abc)Lookahead(?!abc)Neg lookahead(?<=abc)Lookbehind(?<!abc)Neg lookbehind
About the Regex Tester
A regular expression (regex) is a pattern for finding text, such as \d{3}-\d{4} for a phone-number fragment. The tester highlights every match as you type.
How to use it
- 1 Type your regex pattern and choose flags.
- 2 Paste the text to test against.
- 3 Check the highlighted matches and capture groups.
Frequently asked questions
Which regex flavour is used?
JavaScript regular expressions, as used in browsers and Node.js. Most syntax is the same in PHP (PCRE) and Python.
What do the g, i, and m flags do?
g finds all matches instead of just the first, i ignores case, and m makes ^ and $ match at the start and end of each line.
How do I match a literal dot?
Escape it with a backslash: \. On its own, a dot matches any character.