Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250620) (7d9030acd6e)
Composer\Pcre\Regex Class Reference

Static Public Member Functions

static isMatch (string $pattern, string $subject, int $offset=0)
 
static match (string $pattern, string $subject, int $flags=0, int $offset=0)
 
static matchAll (string $pattern, string $subject, int $flags=0, int $offset=0)
 
static matchAllStrictGroups (string $pattern, string $subject, int $flags=0, int $offset=0)
 Variant of matchAll() which returns non-null matches (or throws)
 
static matchAllWithOffsets (string $pattern, string $subject, int $flags=0, int $offset=0)
 Runs preg_match_all with PREG_OFFSET_CAPTURE.
 
static matchStrictGroups (string $pattern, string $subject, int $flags=0, int $offset=0)
 Variant of match() which returns non-null matches (or throws)
 
static matchWithOffsets (string $pattern, string $subject, int $flags=0, int $offset=0)
 Runs preg_match with PREG_OFFSET_CAPTURE.
 
static replace ($pattern, $replacement, $subject, int $limit=-1)
 
static replaceCallback ($pattern, callable $replacement, $subject, int $limit=-1, int $flags=0)
 
static replaceCallbackArray (array $pattern, $subject, int $limit=-1, int $flags=0)
 
static replaceCallbackStrictGroups ($pattern, callable $replacement, $subject, int $limit=-1, int $flags=0)
 Variant of replaceCallback() which outputs non-null matches (or throws)
 

Member Function Documentation

◆ match()

static Composer\Pcre\Regex::match ( string $pattern,
string $subject,
int $flags = 0,
int $offset = 0 )
static
Parameters
non-empty-string$pattern
int-mask<PREG_UNMATCHED_AS_NULL>$flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported

◆ matchAll()

static Composer\Pcre\Regex::matchAll ( string $pattern,
string $subject,
int $flags = 0,
int $offset = 0 )
static
Parameters
non-empty-string$pattern
int-mask<PREG_UNMATCHED_AS_NULL>$flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported

◆ matchAllStrictGroups()

static Composer\Pcre\Regex::matchAllStrictGroups ( string $pattern,
string $subject,
int $flags = 0,
int $offset = 0 )
static

Variant of matchAll() which returns non-null matches (or throws)

Parameters
non-empty-string$pattern
int-mask<PREG_UNMATCHED_AS_NULL>$flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
Exceptions
UnexpectedNullMatchException

◆ matchAllWithOffsets()

static Composer\Pcre\Regex::matchAllWithOffsets ( string $pattern,
string $subject,
int $flags = 0,
int $offset = 0 )
static

Runs preg_match_all with PREG_OFFSET_CAPTURE.

Parameters
non-empty-string$pattern
int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE>$flags PREG_UNMATCHED_AS_NULL and PREG_MATCH_OFFSET are always set, no other flags are supported

◆ matchStrictGroups()

static Composer\Pcre\Regex::matchStrictGroups ( string $pattern,
string $subject,
int $flags = 0,
int $offset = 0 )
static

Variant of match() which returns non-null matches (or throws)

Parameters
non-empty-string$pattern
int-mask<PREG_UNMATCHED_AS_NULL>$flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
Exceptions
UnexpectedNullMatchException

◆ matchWithOffsets()

static Composer\Pcre\Regex::matchWithOffsets ( string $pattern,
string $subject,
int $flags = 0,
int $offset = 0 )
static

Runs preg_match with PREG_OFFSET_CAPTURE.

Parameters
non-empty-string$pattern
int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE>$flags PREG_UNMATCHED_AS_NULL and PREG_MATCH_OFFSET are always set, no other flags are supported

◆ replace()

static Composer\Pcre\Regex::replace ( $pattern,
$replacement,
$subject,
int $limit = -1 )
static
Parameters
string | string[]$pattern
string | string[]$replacement
string$subject

◆ replaceCallback()

static Composer\Pcre\Regex::replaceCallback ( $pattern,
callable $replacement,
$subject,
int $limit = -1,
int $flags = 0 )
static
Parameters
string | string[]$pattern
($flagsis PREG_OFFSET_CAPTURE ? (callable(array<int|string, array{string|null, int<-1, max>}>): string) : callable(array<int|string, string|null>): string) $replacement
string$subject
int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE>$flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set

◆ replaceCallbackArray()

static Composer\Pcre\Regex::replaceCallbackArray ( array $pattern,
$subject,
int $limit = -1,
int $flags = 0 )
static
Parameters
($flagsis PREG_OFFSET_CAPTURE ? (array<string, callable(array<int|string, array{string|null, int<-1, max>}>): string>) : array<string, callable(array<int|string, string|null>): string>) $pattern
string$subject
int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE>$flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set

◆ replaceCallbackStrictGroups()

static Composer\Pcre\Regex::replaceCallbackStrictGroups ( $pattern,
callable $replacement,
$subject,
int $limit = -1,
int $flags = 0 )
static

Variant of replaceCallback() which outputs non-null matches (or throws)

Parameters
string$pattern
($flagsis PREG_OFFSET_CAPTURE ? (callable(array<int|string, array{string, int<0, max>}>): string) : callable(array<int|string, string>): string) $replacement
string$subject
int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE>$flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set

The documentation for this class was generated from the following file: