Skip to content

Regex Tester: Test JavaScript Regular Expressions Online

Test regular expressions live: highlighted matches, capture groups, replace preview, flags and common patterns for email, URL, date and more. JavaScript syntax.

/ /g
Common patterns:
Matches highlighted 0

Match details

#MatchIndexGroups

Replace

How to use the Regex Tester

  1. Type a pattern without the surrounding slashes and tick the flags you need.
  2. Paste test text: every match is highlighted and listed with its position and capture groups.
  3. Enter a replacement using $1, $2 or named groups to preview String.replace().
  4. Start from a common pattern (email, URL, date, hex color, phone, price, slug, IPv4) and adjust it.

Tips

  • Without the g flag only the first match is found, exactly like in JavaScript.
  • Use (?<name>...) for named groups; they appear in the match table.
  • Patterns are checked as you type and errors are explained, so you can fix them before using them in code.

Everything runs in your browser: nothing you type or paste is sent to a server.

More developer tools