Regex Tester
Test and debug regular expressions with real-time matching, replacement, and splitting.
What is a Regular Expression?
A regular expression (regex) is a compact pattern syntax for describing sets of strings — used to validate input, search and extract substrings, and perform structured find-and-replace across text. The notation traces back to Stephen Kleene's 1956 work on regular sets, was popularized by Ken Thompson's 1968 grep implementation, and now ships in every major programming language, text editor, and database. Regex is the lingua franca for email/URL validation, log scraping, code search, route matching, and data cleanup. This tester runs JavaScript's native RegExp engine entirely in your browser with live match highlighting, capture group inspection, and match/replace/split modes. Need to apply your regex across multiple files? Use the Find & Replace tool. Comparing two text versions? Try the Diff Checker.
Pattern
//g
Global (g)
Case Insensitive (i)
Multiline (m)
DotAll (s)
Unicode (u)
Test String
Results
Match
Replace
Split
Enter a pattern and test string to see matches.
Common Patterns
Quick Reference
| \d | Digit (0-9) |
| \D | Non-digit |
| \w | Word character (a-z, A-Z, 0-9, _) |
| \W | Non-word character |
| \s | Whitespace |
| \S | Non-whitespace |
| . | Any character (except newline) |
| ^ | Start of string/line |
| $ | End of string/line |
| * | 0 or more |
| + | 1 or more |
| ? | 0 or 1 (optional) |
| {n} | Exactly n times |
| {n,m} | Between n and m times |
| [abc] | Character class |
| [^abc] | Negated character class |
| (abc) | Capturing group |
| (?:abc) | Non-capturing group |
| a|b | Alternation (a or b) |
| \b | Word boundary |
How to use this tool
- 1Enter your pattern and flagsType the pattern and toggle flags (g, i, m, s, u, y, d) as needed. Invalid patterns surface a syntax error immediately.
- 2Paste your test inputDrop the text you want to match against. Matches highlight in real time and capture groups are listed individually for inspection.
- 3Switch to replace or splitUse the Replace tab to preview substitutions with backreferences ($1, $2), or the Split tab to see how the pattern segments your input.
