DeveloperUtilityEducation

Regex Tester

Online regex tester with live highlighting, capture groups, and replacement preview. Test JavaScript regular expressions safely in your browser with a quick reference cheatsheet.

//

Matches (3)

Contact us at [email protected] or [email protected]. Backup: [email protected] Invalid: not-an-email

Match details

Replace preview

Contact us at [redacted] or [redacted].
Backup: [redacted]
Invalid: not-an-email

Regex cheatsheet

Character classes

  • . — any char except newline
  • \d / \D — digit / non-digit
  • \w / \W — word / non-word
  • \s / \S — whitespace / non-whitespace
  • [abc] — any of a, b, c
  • [^abc] — none of a, b, c

Quantifiers & anchors

  • * — 0 or more
  • + — 1 or more
  • ? — 0 or 1
  • {n,m} — between n and m
  • ^ / $ — start / end of line
  • \b — word boundary

Groups

  • (abc) — capture group
  • (?:abc) — non-capture group
  • (?<name>abc) — named group
  • a|b — alternation

Flags

  • g — global, find all matches
  • i — case-insensitive
  • m — multiline anchors
  • s — dot matches newline
  • u — full unicode

Patterns you can copy

  • Email: ^[\w.+-]+@[\w-]+\.[\w.-]+$
  • URL: https?:\/\/[\w.-]+(?:\/[\w./?%&=-]*)?
  • IPv4: \b(?:\d{1,3}\.){3}\d{1,3}\b
  • Hex color: #(?:[0-9a-fA-F]{3}){1,2}\b
  • UUID: [0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}