← Home

Regex Tester

Contact us
//
Test String
Match Details
Enter a pattern to see matches.

Common Patterns

Email/gi
Standard email address
[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}
URL/gi
http / https URL
https?:\/\/(www\.)?[\w\-]+(\.[\w\-]+)+[\w\-.,@?^=%&:/~+#]*
IPv4 Address/g
Dotted-decimal IP
\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b
IPv6 Address/gi
Full or compressed IPv6
(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,7}:|(?:[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|::(?:[0-9a-fA-F]{1,4}:){0,5}[0-9a-fA-F]{1,4}
Hex Color/gi
#RGB or #RRGGBB
#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b
Date (YYYY-MM-DD)/g
ISO 8601 date
\b\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])\b
Time (HH:MM)/g
24-hour time
\b(?:[01]\d|2[0-3]):[0-5]\d\b
Integer/g
Positive or negative integer
-?\b\d+\b
Decimal/g
Floating-point number
-?\b\d+\.\d+\b
US Phone/g
North American phone number
\+?1?[\s.]?\(?\d{3}\)?[\s.\-]?\d{3}[\s.\-]?\d{4}
US ZIP Code/g
5-digit or ZIP+4
\b\d{5}(?:-\d{4})?\b
Username/g
3–16 alphanumeric chars + underscore
\b[a-zA-Z0-9_]{3,16}\b
Strong Password
8+ chars, upper, lower, digit, symbol
(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}
HTML Tag/gi
Opening HTML tag
<([a-zA-Z][a-zA-Z0-9]*)(?:\s[^>]*)?\s*\/?>
JWT/g
JSON Web Token (3-part)
[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]*
Duplicate Words/gi
Repeated consecutive word
\b(\w+)\s+\1\b
Extra Whitespace/g
Two or more whitespace chars
\s{2,}
Empty Lines/gm
Blank lines in multiline text
^\s*$

What is a regular expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. They are used to match, locate, and manipulate text based on rules — from simple substring searches to complex structured extraction.

JavaScript regex syntax follows the ECMAScript standard, supporting character classes, quantifiers, anchors, groups, lookaheads, and named captures.

Common syntax

  • . — any character except newline
  • \d \w \s — digit, word char, whitespace
  • [abc] — character class; [^abc] negated
  • ^ $ — start / end of string (or line with m)
  • * + ? — 0+, 1+, 0 or 1 occurrences
  • {n,m} — between n and m repetitions
  • (abc) — capturing group; (?:abc) non-capturing
  • (?<name>abc) — named capturing group

Flags

  • g — global: find all matches, not just the first
  • i — case insensitive: A matches a
  • m — multiline: ^/$ match each line boundary
  • s — dotAll: . also matches \n
  • u — unicode: full Unicode support and strict mode

Substitution references

  • $1, $2 — insert capture group 1, 2…
  • $<name> — insert named capture group
  • $& — insert the entire matched substring
  • $` — insert the string before the match
  • $' — insert the string after the match
  • $$ — literal dollar sign