Regular Expression / Pattern

String / Subject

Options

offset
offset
Limit
Limit
Limit
Delimiter

Results

no results until you use the form

Pattern Modifiers

  • i PCRE_CASELESS
  • m PCRE_MULTILINE
  • s PCRE_DOTALL
  • x PCRE_EXTENDED
  • e (Disabled for this tool)
  • A PCRE_ANCHORED
  • D PCRE_DOLLAR_ENDONLY
  • S Extra analysis
  • U PCRE_UNGREEDY
  • X PCRE_EXTRA
  • J PCRE_INFO_JCHANGED
  • u PCRE_UTF8

Meta-characters outside [ ]

  • \ general escape character
  • ^ assert start of subject (or line, in multiline mode)
  • $ assert end of subject (or line, in multiline mode)
  • . match any character except newline (by default)
  • [ ] character class definition
  • | start of alternative branch
  • ( ) subpattern
  • ? extends the meaning of '(', also 0 or 1 quantifier
  • * 0 or more quantifier
  • + 1 or more quantifier
  • { } min/max quantifier, {n[,n]}

Meta-characters inside [ ]

  • \ general escape character
  • ^ negate the class, but only if the first character
  • - indicates character range

Others

  • \1-9 in-group back references
  • (?P<lbl>...) labelize subpatterns
  • (?:...) non-capture group
  • (?>...) Atomic group
  • (?=...) Positive lookahead
  • (?!...) Negative lookahead
  • (?<=..) Positive lookbehind
  • (?<!..) Negative lookbehind
  • (?(?=.).|.) if . then . else .
  • (?#...) Comment

Scape sequences

  • \a alarm, that is, the BEL character (hex 07)
  • \cx "control-x", where x is any character
  • \e escape (hex 1B)
  • \f formfeed (hex 0C)
  • \n newline (hex 0A)
  • \r carriage return (hex 0D)
  • \t tab (hex 09)
  • \p{xx} a character with the xx property
  • \P{xx} a character without the xx property
  • \xhh character with hex code hh
  • \ddd character with octal code ddd, or backreference
  • \d any decimal digit
  • \D any character that is not a decimal digit
  • \s any whitespace character
  • \S any character that is not a whitespace character
  • \h any horizontal whitespace character
  • \H any character that is not a horizontal whitespace
  • \v any vertical whitespace character
  • \V any character that is not a vertical whitespace character
  • \w any "word" character
  • \W any "non-word" character
  • \b word boundary
  • \B not a word boundary
  • \A start of subject (independent of multiline mode)
  • \Z end of subject or newline at end (independent of multiline mode)
  • \z end of subject (independent of multiline mode)
  • \G first matching position in subject
×