Quick reference
\d \w \s | digit, word char, whitespace |
. | any char except newline (use flag s to include newlines) |
^ $ | start / end (per line with flag m) |
* + ? {n,m} | quantifiers; add ? for lazy |
( ) (?:) (?<name>) | capture, non-capture, named group |
(?= ) (?! ) | lookahead, negative lookahead |
Flavor differences
This tester uses JavaScript regex. grep uses POSIX BRE by default (grep -E for extended, grep -P for PCRE); PHP's preg_* functions use PCRE, which is very close to JavaScript for everyday patterns.
Catastrophic backtracking
Patterns like (a+)+$ can take exponential time on certain inputs and freeze a server (ReDoS). This tester runs your pattern in a Web Worker and stops it after 1.5 seconds, so you will see the problem instead of a frozen tab.