Regex
in package
Table of Contents
- isMatch() : bool
- match() : MatchResult
- matchAll() : MatchAllResult
- matchAllWithOffsets() : MatchAllWithOffsetsResult
- Runs preg_match_all with PREG_OFFSET_CAPTURE
- matchWithOffsets() : MatchWithOffsetsResult
- Runs preg_match with PREG_OFFSET_CAPTURE
- replace() : ReplaceResult
- replaceCallback() : ReplaceResult
- replaceCallbackArray() : ReplaceResult
- Available from PHP 7.0
Methods
isMatch()
public
static isMatch(mixed $pattern, string $subject, int $offset) : bool
Parameters
- $pattern : mixed
- $subject : string
- $offset : int
Return values
bool —match()
public
static match(mixed $pattern, string $subject, int $flags, int $offset) : MatchResult
Parameters
- $pattern : mixed
- $subject : string
- $flags : int
-
PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
- $offset : int
Return values
MatchResult —matchAll()
public
static matchAll(mixed $pattern, string $subject, int $flags, int $offset) : MatchAllResult
Parameters
- $pattern : mixed
- $subject : string
- $flags : int
-
PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
- $offset : int
Return values
MatchAllResult —matchAllWithOffsets()
Runs preg_match_all with PREG_OFFSET_CAPTURE
public
static matchAllWithOffsets(mixed $pattern, string $subject, int $flags, int $offset) : MatchAllWithOffsetsResult
Parameters
- $pattern : mixed
- $subject : string
- $flags : int
-
PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
- $offset : int
Return values
MatchAllWithOffsetsResult —matchWithOffsets()
Runs preg_match with PREG_OFFSET_CAPTURE
public
static matchWithOffsets(mixed $pattern, string $subject, int $flags, int $offset) : MatchWithOffsetsResult
Parameters
- $pattern : mixed
- $subject : string
- $flags : int
-
PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
- $offset : int
Return values
MatchWithOffsetsResult —replace()
public
static replace(string|array<string|int, string> $pattern, string|array<string|int, string> $replacement, string $subject[, int $limit = -1 ]) : ReplaceResult
Parameters
- $pattern : string|array<string|int, string>
- $replacement : string|array<string|int, string>
- $subject : string
- $limit : int = -1
Return values
ReplaceResult —replaceCallback()
public
static replaceCallback(string|array<string|int, string> $pattern, callable $replacement, string $subject[, int $limit = -1 ], int $flags) : ReplaceResult
Parameters
- $pattern : string|array<string|int, string>
- $replacement : callable
- $subject : string
- $limit : int = -1
- $flags : int
-
PREG_OFFSET_CAPTURE or PREG_UNMATCHED_AS_NULL, only available on PHP 7.4+
Return values
ReplaceResult —replaceCallbackArray()
Available from PHP 7.0
public
static replaceCallbackArray(array<string, callable> $pattern, string $subject[, int $limit = -1 ], int $flags) : ReplaceResult
Parameters
- $pattern : array<string, callable>
- $subject : string
- $limit : int = -1
- $flags : int
-
PREG_OFFSET_CAPTURE or PREG_UNMATCHED_AS_NULL, only available on PHP 7.4+