FM 5-03 Chapter 5 · Data formats
Regex tester
Test JavaScript regular expressions: highlighted matches, groups, replace preview, explanation.
Local only Runs in your browser. Nothing you enter leaves this page.
Flags
Explanation
(?<word>Start capturing group #1 named "word"\wMatch a word character: letter, digit or _+Repeat the previous item one or more times, as many as possible (greedy))End of group@Match "@"(Start capturing group #2\wMatch a word character: letter, digit or _+Repeat the previous item one or more times, as many as possible (greedy))End of group\.comMatch the text ".com"
Syntax cheat sheet
- . \d \w \s
- any char, digit, word char, whitespace (\D \W \S negate)
- [abc] [^abc] [a-z]
- one of, none of, range
- ^ $ \b \B
- start, end (of line with m), word boundary, not boundary
- * + ? {n} {n,m}
- 0+, 1+, 0 or 1, exactly n, n to m
- *? +? ??
- lazy: as few as possible
- (x) (?:x) (?<n>x)
- capture, group only, named capture
- \1 \k<n>
- backreference by number or name
- (?=x) (?!x)
- lookahead, negative lookahead
- (?<=x) (?<!x)
- lookbehind, negative lookbehind
- a|b
- a or b
- \p{L} \p{Script=Greek}
- Unicode property (u or v flag)
- \t \n \xHH \u{HHHH}
- tab, line feed, hex code unit, code point (u)
- $1 $<n> $& $` $'
- in replacement: group, named group, whole match, before, after
This is the JavaScript engine of your browser. Matching runs in a Web Worker that is stopped after 1 s, so a runaway pattern cannot freeze the page.