Regex Tester

Test Regular Expressions with Live Highlighting

Match highlighting, named groups, replace preview, and common pattern shortcuts — all in your browser.

//
Test string
Matches
Enter a pattern above
Replace with

Uses JavaScript's native RegExp engine. All processing happens in your browser.

How to use the regex tester

  1. Enter your regular expression in the pattern bar at the top.
  2. Toggle flags (g, i, m, s) using the buttons next to the pattern.
  3. Paste your test string or use the built-in sample text.
  4. Matches are highlighted in yellow in real time.
  5. Optionally enter a replacement string to preview substitutions.

Common regex patterns

  • Email: [a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}
  • URL: https?://[^\s]+
  • IPv4: \b(?:\d{1,3}\.){3}\d{1,3}\b
  • Date (YYYY-MM-DD): \d{4}-\d{2}-\d{2}
  • Hex colour: #(?:[0-9a-fA-F]{3}){1,2}\b

Frequently asked questions

This tool uses JavaScript's native RegExp engine, which supports standard features including character classes, quantifiers, groups, lookaheads, lookbehinds, named capture groups, and Unicode properties.

g (global) finds all matches instead of stopping at the first. i (case-insensitive) makes the match ignore letter case. m (multiline) makes ^ and $ match the start and end of each line. s (dotAll) makes the dot . match newline characters too.

Use the (?<name>...) syntax. For example, (?<year>\d{4})-(?<month>\d{2}) captures year and month as named groups. The tool displays captured group values in the Named Groups panel.

Enter a replacement string in the Replace field. Use $1, $2 etc. to insert numbered capture groups, or $<name> for named groups. The replaced result is shown live below the input.

Greedy quantifiers (*, +, ?) match as many characters as possible. Use lazy versions (*?, +?, ??) to match as few as possible. Use anchors (^ and $) and word boundaries (\b) to be more precise.

Yes. The regex engine runs entirely in your browser using JavaScript. Your test string is never sent to any server.

Related Tools

More browser-based utilities you might find useful.