Regex Tester

Test regular expressions with real-time match highlighting. Supports all JavaScript regex flags. All processing in your browser.

Pattern
//g

Common Patterns

  • .Any character except newline
  • \dDigit (0–9)
  • \wWord character (a–z, 0–9, _)
  • \sWhitespace
  • ^Start of string/line
  • $End of string/line

Quantifiers

  • *Zero or more
  • +One or more
  • ?Zero or one (optional)
  • {n}Exactly n times
  • {n,}n or more times
  • {n,m}Between n and m times

How to Test Regular Expressions Online

  1. 1. Type your regex pattern into the Pattern field between the slash markers.
  2. 2. Toggle flags (g = global, i = ignore case, m = multiline, s = dotAll) as needed.
  3. 3. Enter test text in the Test String area — matches highlight in real time.
  4. 4. Use Quick Patterns to load common patterns like Email, URL, or IPv4 as starting points.
  5. 5. Click Copy to copy the full regex with flags for use in code.

Frequently Asked Questions

What regex flavor does this tool use?

This tool uses JavaScript (ECMAScript) regular expressions powered by the browser's native RegExp engine. It supports lookaheads, named capture groups, Unicode, and all standard JS regex features.

What does the g flag do?

The g (global) flag finds ALL matches in the string, not just the first one. Without g, the regex stops after the first match. Enable g to see all occurrences highlighted and listed.

What is the difference between .* and .*??

.* is greedy — it matches as many characters as possible. .*? is lazy — it matches as few characters as possible. Use lazy quantifiers when you want the shortest possible match between two delimiters.

How do I match a literal dot or special character?

Escape it with a backslash: \. matches a literal dot, \* matches a literal asterisk, \( matches a literal parenthesis. All special regex characters (. * + ? ^ $ { } [ ] | ( ) \) must be escaped to match literally.