Regex Mentor

100% in your browser · data never leaves your device

Write, test and understand regular expressions — highlighted matches, groups and a cheatsheet, all evaluated locally in your browser. The paid API endpoint for agents is at POST /api/regex-mentor.

/ /
Highlighted text

  
Matches 0
Cheatsheet
.any char except newline
\d \Ddigit / non-digit
\w \Wword char / non-word
\s \Swhitespace / non-whitespace
\b \Bword boundary / not a boundary
^ $start / end of line (with m)
[abc] [^abc]char set / negated set
[a-z]range
* + ?0+ / 1+ / 0 or 1
{2} {2,} {2,5}exact / min / range
*? +?lazy (non-greedy)
(abc)capturing group
(?:abc)non-capturing group
(?<name>abc)named group
a|balternation
(?=abc) (?!abc)lookahead / negative
(?<=abc) (?<!abc)lookbehind / negative
\1 $1backreference / replacement
g i m s u yglobal, ignore case, multiline, dotAll, unicode, sticky

How to use

  1. Type a regular expression and a sample text.
  2. See matches highlighted live, with named and numbered groups.
  3. Open the cheatsheet for syntax hints.
  4. Copy the pattern or the match list when done.

Where it applies

  • Writing a validation pattern with instant feedback.
  • Explaining an inherited regex you do not fully understand.
  • Extracting groups from log lines.
  • Agents matching text via the paid <code>POST /api/regex-mentor</code> endpoint.