Home/Text & Encoding/Regex Tester
Back to tools

Regex Tester

Test regular expressions with real-time matching, syntax highlighting, and pattern replacement

Examples:
//

Quick Reference

Character Classes

  • . - Any character (except newline)
  • \\d - Digit [0-9]
  • \\D - Not a digit
  • \\w - Word character [a-zA-Z0-9_]
  • \\W - Not a word character
  • \\s - Whitespace
  • \\S - Not whitespace
  • [abc] - Any of a, b, or c
  • [^abc] - Not a, b, or c
  • [a-z] - Character range

Quantifiers

  • * - 0 or more
  • + - 1 or more
  • ? - 0 or 1
  • {n} - Exactly n times
  • {n,} - n or more times
  • {n,m} - Between n and m times
  • *? - Lazy quantifier

Anchors & Boundaries

  • ^ - Start of string/line
  • $ - End of string/line
  • \\b - Word boundary
  • \\B - Not word boundary

Groups & Lookaround

  • (abc) - Capturing group
  • (?:abc) - Non-capturing group
  • (?=abc) - Positive lookahead
  • (?!abc) - Negative lookahead
  • \\1 - Backreference to group 1

Replacement Patterns

  • $& - Entire match
  • $1, $2 - Captured groups
  • $` - Text before match
  • $' - Text after match