Reset
Help ↓
preg_match
preg_match_all
preg_split
preg_replace
php.net help
PREG_OFFSET_CAPTURE
, offset:
(optional)
php.net help
PREG_PATTERN_ORDER
PREG_SET_ORDER
PREG_OFFSET_CAPTURE
, offset:
(optional)
php.net help
PREG_SPLIT_NO_EMPTY
PREG_SPLIT_DELIM_CAPTURE
PREG_SPLIT_OFFSET_CAPTURE
Limit:
php.net help
Limit:
Regular Expression
Replacement
String / Subject
Results
waiting...
Pattern Modifiers
i
PCRE_CASELESS
m
PCRE_MULTILINE
s
PCRE_DOTALL
x
PCRE_EXTENDED
e
(Disabled for this site)
A
PCRE_ANCHORED
D
PCRE_DOLLAR_ENDONLY
S
Extra analysis
U
PCRE_UNGREEDY
X
PCRE_EXTRA
u
PCRE_UTF8
Pattern Syntax
\
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)
[ ]
class definition
|
start of alternative branch (OR)
(...)
subpattern
?
extends the meaning of '(', also 0 or 1 quantifier
*
0 or more quantifier
+
1 or more quantifier
{ }
min/max quantifier, {n[,n]}
[^...]
characters class negation
\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)
\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
\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
\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