class Regexp implements ConfigProvider, FilterableConfigValue

Properties

protected bool $isGlobal
protected string $jsRegexp
protected string $regexp

Methods

__construct(string $regexp, bool $isGlobal = false)

Constructor

string
__toString()

Return this regexp as a string

array|Dictionary|null
asConfig()

Return an array-based representation of this object to be used for parsing

mixed
filterConfig($target)

Return the config value for given target

string[]
getCaptureNames()

Return the name of each capture in this regexp

string
getJS()

Return this regexp's JavaScript representation

array
getNamedCaptures()

Return all the named captures with a standalone regexp that matches them

array
getNamedCapturesExpressions(array $tokens)

Return the expression used in each named capture

void
setJS(string $jsRegexp)

Set this regexp's JavaScript representation

Details

at line 40
__construct(string $regexp, bool $isGlobal = false)

Constructor

Parameters

string $regexp

PCRE regexp, with delimiters and modifiers, e.g. "/foo/i"

bool $isGlobal

Whether this regexp should have the global flag set in JavaScript

at line 56
string __toString()

Return this regexp as a string

Return Value

string

at line 64
array|Dictionary|null asConfig()

Return an array-based representation of this object to be used for parsing

NOTE: if this method was named getConfig() it could interfere with magic getters from the Configurable trait

Return Value

array|Dictionary|null

at line 72
mixed filterConfig($target)

Return the config value for given target

Parameters

$target

Return Value

mixed

at line 82
string[] getCaptureNames()

Return the name of each capture in this regexp

Return Value

string[]

at line 92
string getJS()

Return this regexp's JavaScript representation

Return Value

string

at line 107
array getNamedCaptures()

Return all the named captures with a standalone regexp that matches them

Return Value

array

Array of [capture name => regexp]

at line 134
protected array getNamedCapturesExpressions(array $tokens)

Return the expression used in each named capture

Parameters

array $tokens

Return Value

array

at line 162
void setJS(string $jsRegexp)

Set this regexp's JavaScript representation

Parameters

string $jsRegexp

Return Value

void