Regular Expression
Free online regex tester tool, real-time match preview
About Regex Tester
A JavaScript RegExp workbench that runs entirely in your browser. Type a pattern, set flags with toggle buttons, and instantly see matches highlighted in the test string plus a per-match breakdown with index, length, and capture groups. Extra panels include a human-readable pattern explanation, a replacement preview using $ syntax, eight ready-to-use common patterns, and a searchable cheatsheet of regex tokens.
How to Use
1. Enter your pattern between the / delimiters; the live badge shows /pattern/flags. 2. Toggle flags with the g/i/m/s/u/y buttons (hover for names). 3. Type your test string in the left card; matches highlight and list in the right card. 4. Expand Replacement to preview text.replace output, Common Patterns to insert presets, or Cheatsheet to copy tokens. 5. Use the reset (RotateCcw) button to clear pattern, test string, flags, and replacement.
Flags, Matches & Cheatsheet
Six flag toggles map directly to JavaScript flags: g (global, finds all matches), i (case-insensitive), m (multiline ^/$), s (dotAll, . matches newline), u (unicode), and y (sticky). Without g only the first match is returned. Each match card shows the index, matched text, length, and any numbered capture groups color-coded $1-$5. Replacement uses standard JavaScript $1/$& syntax against the compiled regex. The cheatsheet groups tokens into Characters, Quantifiers, Anchors, Groups, Lookaround, Flags, and Special characters, and clicking any row copies the token to your clipboard.
▶Why does my pattern only return one match?
▶What flavor of regular expressions does this support?
▶How do capture groups appear in the results?
▶Can I copy a regex token directly from the cheatsheet?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee