Free online regex tester. Real-time test and debug JavaScript regular expressions with g/i/m/s/u/y flags, highlighted matches, capture groups, match positions, and replace preview. Essential tool for developers. | No sign-up ยท Data never leaves your browser
Zero dependencies ยท Works offline| Symbol | Meaning | Example | Matches |
|---|---|---|---|
| . | Any char (except newline) | a.c | abc, a1c |
| \d | Digit [0-9] | \d+ | 123, 4567 |
| \w | Word char [a-zA-Z0-9_] | \w+ | hello_world |
| \s | Whitespace | a\s+b | a b, a b |
| \b | Word boundary | \bcat\b | cat (not catch) |
| ^ | Start of line | ^Hello | Hello at start |
| $ | End of line | world$ | world at end |
| * | 0 or more | ab*c | ac, abc, abbc |
| + | 1 or more | ab+c | abc, abbc |
| ? | 0 or 1 | ab?c | ac, abc |
| {n} | Exactly n | \d{4} | 2024 |
| ( ) | Capture group | (\d+)-(\d+) | 123-456, $1=123 |
| [abc] | Character class | [aeiou] | Any vowel |
| [^abc] | Negated class | [^0-9] | Non-digit |
| | | Alternation | cat|dog | cat or dog |
g (global) finds all matches instead of stopping at the first. i (ignoreCase) ignores case. m (multiline) makes ^ and $ match start/end of each line. s (dotAll) makes . match newlines too. u (unicode) enables Unicode support. y (sticky) matches from lastIndex position.
Capture groups use parentheses () to extract matched substrings. For example, regex (\d{4})-(\d{2})-(\d{2}) matching '2024-01-15' yields group 1='2024', group 2='01', group 3='15'. Use $1, $2 in replacements.
Check that special characters are properly escaped (e.g., \d for digits), flags are correct (e.g., need g flag for multiple matches), and the regex syntax is valid. This tool shows real-time error messages to help debug.