Flags Reference
| g | Global ??find all matches, not just the first. |
| i | Case-insensitive. |
| m | Multiline ??^ and $ match line starts/ends. |
| s | Dotall ??. matches newlines too. |
| u | Unicode ??proper handling of code points above U+FFFF. |
| y | Sticky ??match starts only from lastIndex. |
| d | Provides indices for matches (modern engines). |
Cheat Sheet
| . | Any character except newline (unless s flag) |
| \d | Digit; \D non-digit |
| \w | Word char [A-Za-z0-9_]; \W non-word |
| \s | Whitespace; \S non-whitespace |
| ^ / $ | Start / end of string (or line with m flag) |
| \b | Word boundary |
| [abc] | Character class ??a, b, or c |
| [^abc] | Anything except a, b, c |
| a|b | Alternation ??a OR b |
| (...) | Capture group |
| (?:...) | Non-capture group |
| (?<name>...) | Named group |
| (?=...) | Positive lookahead |
| (?!...) | Negative lookahead |
| * + ? | 0+, 1+, 0 or 1; append ? for lazy |
| {n,m} | Between n and m repetitions |
Notes
This tester uses the browser's native JavaScript regex engine. It differs from Perl, Python, PCRE, and other dialects in a few ways ??no possessive quantifiers, no atomic groups, and limited support for some Unicode property escapes in older engines.