Use the form below to test regular expressions. Enter a regular expression, some input text, and click the Match button. You can click the result to see where it matched in the input, and click the reference items below to enter them into the regex. For a good quick regex reference, see the Mozilla Developer Center.


Regular Expression

Search Text



Character Classes

  • .Any character except a newline
  • \dAny decimal digit
  • \DAny non-digit
  • \sAny whitespace character
  • \SAny non-whitespace character
  • \wAny word character
  • \WAny non-word character


  • *0-∞ of the preceding block
  • +1-∞ of the preceding block
  • ?0 or one of the preceding block
  • {m}Exactly 'm' of the preceding block
  • {m,n}'m' to 'n' of the preceding block


  • |Alternation
  • [ ]Character set
  • ^Beginning of line
  • $End of line
  • \bA word boundary
  • \BNOT a word boundary

Grouping constructs

  • ( )A group
  • (?: )Non-capturing group
  • (?= )Positive lookahead assertion
  • (?! )Negative lookahead assertion
  • \nBackreference to the nth group