Preg
in package
Table of Contents
Methods
- grep() : array<string|int, T>
- isMatch() : bool
- Variant of match() which returns a bool instead of int
- isMatchAll() : bool
- Variant of matchAll() which returns a bool instead of int
- isMatchAllStrictGroups() : bool
- Variant of `isMatchAll()` which outputs non-null matches (or throws)
- isMatchAllWithOffsets() : bool
- Variant of matchAllWithOffsets() which returns a bool instead of int
- isMatchStrictGroups() : bool
- Variant of `isMatch()` which outputs non-null matches (or throws)
- isMatchWithOffsets() : bool
- Variant of matchWithOffsets() which returns a bool instead of int
- match() : 0|1
- matchAll() : 0|positive-int
- matchAllStrictGroups() : 0|positive-int
- Variant of `match()` which outputs non-null matches (or throws)
- matchAllWithOffsets() : 0|positive-int
- Runs preg_match_all with PREG_OFFSET_CAPTURE
- matchStrictGroups() : 0|1
- Variant of `match()` which outputs non-null matches (or throws)
- matchWithOffsets() : 0|1
- Runs preg_match with PREG_OFFSET_CAPTURE
- replace() : string
- replaceCallback() : string
- replaceCallbackArray() : string
- replaceCallbackStrictGroups() : string
- Variant of `replaceCallback()` which outputs non-null matches (or throws)
- split() : array<int, string>
- splitWithOffsets() : array<int, array{: string, : int}>
Methods
grep()
public
static grep(string $pattern, array<string|int, T> $array[, int $flags = 0 ]) : array<string|int, T>
Parameters
- $pattern : string
- $array : array<string|int, T>
- $flags : int = 0
Tags
Return values
array<string|int, T>isMatch()
Variant of match() which returns a bool instead of int
public
static isMatch(non-empty-string $pattern, string $subject[, array<string|int, mixed> &$matches = null ][, int $flags = 0 ][, int $offset = 0 ]) : bool
Parameters
- $pattern : non-empty-string
- $subject : string
- $matches : array<string|int, mixed> = null
-
Set by method
- $flags : int = 0
- $offset : int = 0
Tags
Return values
boolisMatchAll()
Variant of matchAll() which returns a bool instead of int
public
static isMatchAll(non-empty-string $pattern, string $subject[, array<string|int, mixed> &$matches = null ][, int $flags = 0 ][, int $offset = 0 ]) : bool
Parameters
- $pattern : non-empty-string
- $subject : string
- $matches : array<string|int, mixed> = null
-
Set by method
- $flags : int = 0
- $offset : int = 0
Tags
Return values
boolisMatchAllStrictGroups()
Variant of `isMatchAll()` which outputs non-null matches (or throws)
public
static isMatchAllStrictGroups(non-empty-string $pattern, string $subject[, array<string|int, mixed> &$matches = null ][, int $flags = 0 ][, int $offset = 0 ]) : bool
Parameters
- $pattern : non-empty-string
- $subject : string
- $matches : array<string|int, mixed> = null
-
Set by method
- $flags : int = 0
- $offset : int = 0
Tags
Return values
boolisMatchAllWithOffsets()
Variant of matchAllWithOffsets() which returns a bool instead of int
public
static isMatchAllWithOffsets(non-empty-string $pattern, string $subject, array<string|int, mixed> &$matches[, int $flags = 0 ][, int $offset = 0 ]) : bool
Runs preg_match_all with PREG_OFFSET_CAPTURE
Parameters
- $pattern : non-empty-string
- $subject : string
- $matches : array<string|int, mixed>
-
Set by method
- $flags : int = 0
- $offset : int = 0
Tags
Return values
boolisMatchStrictGroups()
Variant of `isMatch()` which outputs non-null matches (or throws)
public
static isMatchStrictGroups(non-empty-string $pattern, string $subject[, array<string|int, mixed> &$matches = null ][, int $flags = 0 ][, int $offset = 0 ]) : bool
Parameters
- $pattern : non-empty-string
- $subject : string
- $matches : array<string|int, mixed> = null
-
Set by method
- $flags : int = 0
- $offset : int = 0
Tags
Return values
boolisMatchWithOffsets()
Variant of matchWithOffsets() which returns a bool instead of int
public
static isMatchWithOffsets(non-empty-string $pattern, string $subject, array<string|int, mixed> &$matches[, int $flags = 0 ][, int $offset = 0 ]) : bool
Runs preg_match with PREG_OFFSET_CAPTURE
Parameters
- $pattern : non-empty-string
- $subject : string
- $matches : array<string|int, mixed>
-
Set by method
- $flags : int = 0
- $offset : int = 0
Tags
Return values
boolmatch()
public
static match(non-empty-string $pattern, string $subject[, array<string|int, mixed> &$matches = null ][, int $flags = 0 ][, int $offset = 0 ]) : 0|1
Parameters
- $pattern : non-empty-string
- $subject : string
- $matches : array<string|int, mixed> = null
-
Set by method
- $flags : int = 0
- $offset : int = 0
Tags
Return values
0|1matchAll()
public
static matchAll(non-empty-string $pattern, string $subject[, array<string|int, mixed> &$matches = null ][, int $flags = 0 ][, int $offset = 0 ]) : 0|positive-int
Parameters
- $pattern : non-empty-string
- $subject : string
- $matches : array<string|int, mixed> = null
-
Set by method
- $flags : int = 0
- $offset : int = 0
Tags
Return values
0|positive-intmatchAllStrictGroups()
Variant of `match()` which outputs non-null matches (or throws)
public
static matchAllStrictGroups(non-empty-string $pattern, string $subject[, array<string|int, mixed> &$matches = null ][, int $flags = 0 ][, int $offset = 0 ]) : 0|positive-int
Parameters
- $pattern : non-empty-string
- $subject : string
- $matches : array<string|int, mixed> = null
-
Set by method
- $flags : int = 0
- $offset : int = 0
Tags
Return values
0|positive-intmatchAllWithOffsets()
Runs preg_match_all with PREG_OFFSET_CAPTURE
public
static matchAllWithOffsets(non-empty-string $pattern, string $subject, array<string|int, mixed> &$matches[, int $flags = 0 ][, int $offset = 0 ]) : 0|positive-int
Parameters
- $pattern : non-empty-string
- $subject : string
- $matches : array<string|int, mixed>
-
Set by method
- $flags : int = 0
- $offset : int = 0
Tags
Return values
0|positive-intmatchStrictGroups()
Variant of `match()` which outputs non-null matches (or throws)
public
static matchStrictGroups(non-empty-string $pattern, string $subject[, array<string|int, mixed> &$matches = null ][, int $flags = 0 ][, int $offset = 0 ]) : 0|1
Parameters
- $pattern : non-empty-string
- $subject : string
- $matches : array<string|int, mixed> = null
-
Set by method
- $flags : int = 0
- $offset : int = 0
Tags
Return values
0|1matchWithOffsets()
Runs preg_match with PREG_OFFSET_CAPTURE
public
static matchWithOffsets(non-empty-string $pattern, string $subject, array<string|int, mixed> &$matches[, int $flags = 0 ][, int $offset = 0 ]) : 0|1
Parameters
- $pattern : non-empty-string
- $subject : string
- $matches : array<string|int, mixed>
-
Set by method
- $flags : int = 0
- $offset : int = 0
Tags
Return values
0|1replace()
public
static replace(string|array<string|int, string> $pattern, string|array<string|int, string> $replacement, string $subject[, int $limit = -1 ][, int &$count = null ]) : string
Parameters
- $pattern : string|array<string|int, string>
- $replacement : string|array<string|int, string>
- $subject : string
- $limit : int = -1
- $count : int = null
-
Set by method
Tags
Return values
stringreplaceCallback()
public
static replaceCallback(string|array<string|int, string> $pattern, mixed $replacement, string $subject[, int $limit = -1 ][, int &$count = null ][, int $flags = 0 ]) : string
Parameters
- $pattern : string|array<string|int, string>
- $replacement : mixed
- $subject : string
- $limit : int = -1
- $count : int = null
-
Set by method
- $flags : int = 0
Tags
Return values
stringreplaceCallbackArray()
public
static replaceCallbackArray(mixed $pattern, string $subject[, int $limit = -1 ][, int &$count = null ][, int $flags = 0 ]) : string
Parameters
- $pattern : mixed
- $subject : string
- $limit : int = -1
- $count : int = null
-
Set by method
- $flags : int = 0
Tags
Return values
stringreplaceCallbackStrictGroups()
Variant of `replaceCallback()` which outputs non-null matches (or throws)
public
static replaceCallbackStrictGroups(string $pattern, mixed $replacement, string $subject[, int $limit = -1 ][, int &$count = null ][, int $flags = 0 ]) : string
Parameters
- $pattern : string
- $replacement : mixed
- $subject : string
- $limit : int = -1
- $count : int = null
-
Set by method
- $flags : int = 0
Tags
Return values
stringsplit()
public
static split(string $pattern, string $subject[, int $limit = -1 ][, int $flags = 0 ]) : array<int, string>
Parameters
- $pattern : string
- $subject : string
- $limit : int = -1
- $flags : int = 0
Return values
array<int, string>splitWithOffsets()
public
static splitWithOffsets(string $pattern, string $subject[, int $limit = -1 ][, int $flags = 0 ]) : array<int, array{: string, : int}>
Parameters
- $pattern : string
- $subject : string
- $limit : int = -1
- $flags : int = 0