Regex Tester
Type a regular expression and a test text — matches light up as you type, with positions and capture groups listed below. Works with JavaScript (RegExp) syntax.
—
Cheat sheet
| . | Any character except a newline (with flag s: truly any character) |
| \d \w \s | Digit / word character (letter, digit, _) / whitespace. Uppercase versions (\D \W \S) mean the opposite |
| [a-z] [^0-9] | A character in the set / NOT in the set |
| * + ? | 0 or more / 1 or more / 0 or 1 of the previous item |
| {2,4} | Between 2 and 4 of the previous item |
| ^ $ | Start / end of the text (or of each line with flag m) |
| \b | Word boundary — the edge between a word character and a non-word character |
| ( ... ) | Capture group — its matched text is listed in the results and usable as $1, $2… in replacements |
| (?: ... ) | Group without capturing |
| a|b | "a" or "b" |
| \. \\ \+ | A backslash escapes a special character so it matches literally |
FAQ
Which regex flavor is this?
JavaScript's RegExp, the same engine your browser runs. Most everyday patterns behave the same in Python, PHP and other PCRE-like flavors, but lookbehind syntax and some flags differ between languages — test again in your target environment before shipping.
Why does only the first match show up?
Without the g flag, a regex stops at the first match. Tick the g checkbox to find all matches. Note that a pattern that can match an empty string (like a*) is handled safely here — empty matches are shown once per position instead of looping forever.
Is my text sent anywhere?
No. Testing and replacing happen entirely in your browser.
Related tools
JSON to CSV Converter
Turn a JSON array into a CSV file — flat objects, your choice of delimiter.
JSON Formatter & Validator
Pretty-print, minify and validate JSON — errors come with line and column numbers.
Text Diff Checker
Compare two texts line by line and highlight added and removed lines.
Case Converter
Convert text to UPPER, Title, Sentence, camelCase, snake_case and more.