Regex Tester

Test JavaScript regular expressions with live match highlighting

Enter a pattern above to start matching
Quick Guide
  • Enter a pattern without slashes — e.g. \d+
  • Enable the g flag to find all matches
  • Matches are highlighted yellow in the preview below
  • Capturing groups are shown per match

Common Regex Examples

Click any example to load it into the tester:

^[^\s@]+@[^\s@]+\.[^\s@]+$ Email address
^[A-Z]{1,2}\d[A-Z\d]? \d[A-Z]{2}$ UK Postcode
^(\d{1,3}\.){3}\d{1,3}$ IPv4 address
\b\d{4}-\d{2}-\d{2}\b ISO date (YYYY-MM-DD)
https?:\/\/[^\s]+ URL

What is a Regular Expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. They are used in JavaScript, Python, Bash, and most other languages for:

  • Validating inputs (emails, postcodes, phone numbers)
  • Extracting data from text and log files
  • Finding and replacing text patterns
  • Parsing structured data formats

Regex Flags Explained

Flag Name Description
gGlobalFind all matches, not just the first
iCase-insensitiveMatch regardless of upper/lower case
mMultiline^ and $ match start/end of each line
sDotAll. matches newline characters too
uUnicodeEnables full Unicode matching