Regular expression tool - regex.larsolavtorvik.com: "Help PHP PCRE
.
Any character
^
Start of subject (or line in multiline mode)
$
End of subject (or line in multiline mode)
[
Start character class definition
]
End character class definition
|
Alternates (OR)
(
Start subpattern
)
End subpattern
\
Escape character
\n
Newline (hex 0A)
\r
Carriage return (hex 0D)
\t
Tab (hex 09)
\d
Decimal digit
\D
Charchater that is not a decimal digit
\h
Horizontal whitespace character
\H
Character that is not a horizontal whitespace character
\s
Whitespace character
\S
Character that is not a whitespace character
\v
Vertical whitespace character
\V
Character that is not a vertical whitespace character
\w
'Word' character
\W
'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
n*
Zero or more of n
n+
One or more of n
n?
Zero or one occurrences of n
{n}
n occurrences
{n,}
At least n occurrences
{,m}
At the most m occurrences
{n,m}
Between n and m occurrences"
- Possible modifiers in regex patterns
============================ - i (PCRE_CASELESS)
- If this modifier is set, letters in the pattern match both upper and lower case letters.
- s (PCRE_DOTALL)
- If this modifier is set, a dot metacharacter in the pattern matches all characters, including newlines. Without it, newlines are excluded. This modifier is equivalent to Perl's /s modifier. A negative class such as [^a] always matches a newline character, independent of the setting of this modifier.
- U (PCRE_UNGREEDY)
- This modifier inverts the "greediness" of the quantifiers so that they are not greedy by default, but become greedy if followed by "?". It is not compatible with Perl. It can also be set by a (?U) modifier setting within the pattern or by a question mark behind a quantifier (e.g. .*?).
No comments:
Post a Comment