Methods |
public
static
|
grep<TKey is array-key, TValue is int|float|string|bool|Stringable|null>(
string $pattern,
array<TKey, TValue> $array,
int-mask-of<PREG_GREP_INVERT> $flags = 0,
): array<TKey, TValue>
A wrapper for preg_grep()
A wrapper for preg_grep()
|
#
|
public
static
|
match<TFlags is int-mask-of<PREG_OFFSET_CAPTURE|PREG_UNMATCHED_AS_NULL>>(
string $pattern,
string $subject,
mixed[]|null &$matches = null,
TFlags $flags = 0,
int $offset = 0,
): int
A wrapper for preg_match()
A wrapper for preg_match()
|
#
|
public
static
|
matchAll<TFlags is int-mask-of<PREG_PATTERN_ORDER|PREG_SET_ORDER|PREG_OFFSET_CAPTURE|PREG_UNMATCHED_AS_NULL>>(
string $pattern,
string $subject,
mixed[]|null &$matches = null,
TFlags $flags = 0,
int $offset = 0,
): int
A wrapper for preg_match_all()
A wrapper for preg_match_all()
|
#
|
public
static
|
replace<T is string[]|string>(
string[]|string $pattern,
string[]|string $replacement,
T $subject,
int $limit = -1,
?int &$count = null,
): T
A wrapper for preg_replace()
A wrapper for preg_replace()
|
#
|
public
static
|
replaceCallback<T is string[]|string, TFlags is int-mask-of<PREG_OFFSET_CAPTURE|PREG_UNMATCHED_AS_NULL>>(
string[]|string $pattern,
(TFlags is 256 ? callable(array<array{string, int}>): string : (TFlags is 512 ? callable(array<string|null>): string : (TFlags is 768 ? callable(array<array{(string|null), int}>): string : callable(array<string>): string))) $callback,
T $subject,
int $limit = -1,
?int &$count = null,
TFlags $flags = 0,
): T
A wrapper for preg_replace_callback()
A wrapper for preg_replace_callback()
|
#
|
public
static
|
replaceCallbackArray<T is string[]|string, TFlags is int-mask-of<PREG_OFFSET_CAPTURE|PREG_UNMATCHED_AS_NULL>>(
(TFlags is 256 ? array<string, callable(array<array{string, int}>): string> : (TFlags is 512 ? array<string, callable(array<string|null>): string> : (TFlags is 768 ? array<string, callable(array<array{(string|null), int}>): string> : array<string, callable(array<string>): string>))) $pattern,
T $subject,
int $limit = -1,
?int &$count = null,
TFlags $flags = 0,
): T
A wrapper for preg_replace_callback_array()
A wrapper for preg_replace_callback_array()
|
#
|
public
static
|
split(
string $pattern,
string $subject,
int $limit = -1,
int-mask-of<PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_OFFSET_CAPTURE> $flags = 0,
): ($flags is 1|3|5|7 ? string[] : non-empty-array<string>)
A wrapper for preg_split()
A wrapper for preg_split()
|
#
|
public
static
|
delimit(string $pattern, string $delimiter = '/'): string
Enclose a pattern in delimiters
Enclose a pattern in delimiters
|
#
|
public
static
|
quoteCharacterClass(string $characters, string|null $delimiter = null): string
Quote characters for use in a character class
Quote characters for use in a character class
Parameters
$delimiter |
The PCRE pattern delimiter to escape.
Forward slash ('/') is most commonly used.
|
|
#
|
public
static
|
quoteReplacement(string $replacement): string
Quote a string for use with replace()
Quote a string for use with replace()
|
#
|
Constants |
public
|
INVISIBLE_CHAR = '[\x{00A0}\x{00AD}\x{034F}\x{061C}\x{115F}\x{1160}\x{1680}\x{17B4}\x{17B5}\x{180B}-\x{180F}\x{2000}-\x{200F}\x{202A}-\x{202F}\x{205F}-\x{206F}\x{3000}\x{3164}\x{FE00}-\x{FE0F}\x{FEFF}\x{FFA0}\x{FFF0}-\x{FFF8}\x{1BCA0}-\x{1BCA3}\x{1D173}-\x{1D17A}\x{E0000}-\x{E0FFF}]'
Characters with the "Default_Ignorable_Code_Point" property or in the
"Space_Separator" category
Characters with the "Default_Ignorable_Code_Point" property or in the
"Space_Separator" category
|
#
|
public
|
BOOLEAN_STRING = "(?xi)\n\\s*+ (?:\n (?<true> 1 | on | y(?:es)? | true | enabled? ) |\n (?<false> 0 | off | no? | false | disabled? )\n) \\s*+"
A boolean string, e.g. "yes", "Y", "On", "TRUE", "enabled"
A boolean string, e.g. "yes", "Y", "On", "TRUE", "enabled"
|
#
|
public
|
INTEGER_STRING = '\s*+[+-]?[0-9]+\s*+'
An integer string
|
#
|
public
|
HTTP_TOKEN = '(?i)[-0-9a-z!#$%&\'*+.^_`|~]++'
A token in an [RFC7230]-compliant HTTP message
A token in an [RFC7230]-compliant HTTP message
|
#
|
public
|
UUID = '(?i)[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}'
An [RFC4122]-compliant version 4 UUID
An [RFC4122]-compliant version 4 UUID
|
#
|
public
|
MONGODB_OBJECTID = '(?i)[0-9a-f]{24}'
A 12-byte MongoDB ObjectId
A 12-byte MongoDB ObjectId
|
#
|
public
|
PHP_IDENTIFIER = '[[:alpha:]_\x80-\xff][[:alnum:]_\x80-\xff]*'
A valid PHP identifier
|
#
|
public
|
PHP_TYPE = '(?:\\\\?' . self::PHP_IDENTIFIER . ')+'
A valid PHP type, i.e. a PHP_IDENTIFIER with an optional namespace
A valid PHP type, i.e. a PHP_IDENTIFIER with an optional namespace
|
#
|
public
|
PHP_UNION_TYPE = self::PHP_TYPE . '(?:\|' . self::PHP_TYPE . ')+'
A PHP union type, e.g. "A|B|C"
A PHP union type, e.g. "A|B|C"
|
#
|
public
|
PHP_INTERSECTION_TYPE = self::PHP_TYPE . '(?:&' . self::PHP_TYPE . ')+'
A PHP intersection type, e.g. "A&B&C"
A PHP intersection type, e.g. "A&B&C"
|
#
|
public
|
PHP_DNF_SEGMENT = '(?:' . self::PHP_TYPE . '|\(' . self::PHP_INTERSECTION_TYPE . '\))'
One of the segments in a PHP DNF type, e.g. "A" or "(B&C)"
One of the segments in a PHP DNF type, e.g. "A" or "(B&C)"
|
#
|
public
|
PHP_DNF_TYPE = self::PHP_DNF_SEGMENT . '(?:\|' . self::PHP_DNF_SEGMENT . ')+'
A PHP DNF type, e.g. "A|(B&C)|D|E"
A PHP DNF type, e.g. "A|(B&C)|D|E"
|
#
|
public
|
PHP_FULL_TYPE = self::PHP_DNF_SEGMENT . '(?:\|' . self::PHP_DNF_SEGMENT . ')*'
A valid PHP type, including union, intersection, and DNF types
A valid PHP type, including union, intersection, and DNF types
|
#
|