FM Field Manual smhansen.dev

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

  1. (?<word> Start capturing group #1 named "word"
  2. \w Match a word character: letter, digit or _
  3. + Repeat the previous item one or more times, as many as possible (greedy)
  4. ) End of group
  5. @ Match "@"
  6. ( Start capturing group #2
  7. \w Match a word character: letter, digit or _
  8. + Repeat the previous item one or more times, as many as possible (greedy)
  9. ) End of group
  10. \.com Match 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.

  • No entry in this manual matches “”.

↑ ↓ move · Enter open · Esc close