Home › Tools

Regex tester (JavaScript)

Enter a JavaScript regular expression and some text to highlight every match and inspect its capture groups as you type.

🔒 Runs entirely in your browser. Nothing you paste is uploaded or sent to a server.

//

Flags

Flag Name Effect
g global find all matches, not just the first
i ignore case a matches A
m multiline ^ and $ match at every line break
s dotAll . also matches newlines
u unicode full Unicode, \u{1F600} and \p{L} escapes
v unicodeSets u plus set operations in classes (newer browsers)
y sticky match only at lastIndex
d indices record start/end of each group

Cheat sheet

Pattern Matches
. any character except newline
\d \w \s digit, word character [A-Za-z0-9_], whitespace
\D \W \S the opposites
[abc] [^abc] [a-z] one of, none of, range
^ $ \b start, end, word boundary
* + ? {2,5} 0+, 1+, optional, 2 to 5 times
*? +? lazy (as few as possible)
(…) (?:…) (?<name>…) capture, non-capturing, named group
a|b a or b
(?=…) (?!…) (?<=…) (?<!…) lookahead, negative lookahead, lookbehind, negative lookbehind
\1 \k<name> backreference

JavaScript-specific gotchas

Python's re, PCRE (PHP) and Go's RE2 differ in details: Python uses (?P<name>…), and RE2 has no lookarounds or backreferences.

Last updated 2026-11-01.