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(
string[]|string $pattern,
string[]|string $replacement,
string[]|string $subject,
int $limit = -1,
?int &$count = null,
): ($subject is string[] ? string[] : string)
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
|
quote(string $str, string|null $delimiter = null): string
Quote a string for use in a regular expression
Quote a string for use in a regular expression
Parameters
$delimiter |
The PCRE pattern delimiter to escape.
Forward slash ('/' ) is the most commonly used delimiter.
|
|
#
|
public
static
|
quoteCharacters(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 the most commonly used delimiter.
|
|
#
|
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 = '(?:(?i)' . '(?<true>1|on|y(?:es)?|true|enabled?)|' . '(?<false>0|off|no?|false|disabled?)' . ')'
A boolean string
|
#
|
public
|
INTEGER_STRING = '(?:[+-]?[0-9]+)'
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 PHP identifier
|
#
|
public
|
PHP_TYPE = '(?:(?:\\\\?' . self::PHP_IDENTIFIER . ')+)'
A PHP type, i.e. an identifier with an optional namespace
A PHP type, i.e. an identifier with an optional namespace
|
#
|