abstract class RegexpParser

Methods

static string
getAllowedCharacterRegexp(string $regexp)

Generate a regexp that matches any single character allowed in a regexp

static string[]
getCaptureNames(string $regexp)

Return the name of each capture in given regexp

static array
parse(string $regexp)

No description

Details

at line 26
static string getAllowedCharacterRegexp(string $regexp)

Generate a regexp that matches any single character allowed in a regexp

This method will generate a regexp that can be used to determine whether a given character could in theory be allowed in a string that matches the source regexp. For example, the source regexp /^a+$/D would generate /a/ while /^foo\d+$/D would generate /[fo\d]/ whereas the regexp /foo/ would generate // because it's not anchored so any characters could be found before or after the literal "foo".

Parameters

string $regexp

Source regexp

Return Value

string

Regexp that matches any single character allowed in the source regexp

at line 192
static string[] getCaptureNames(string $regexp)

Return the name of each capture in given regexp

Will return an empty string for unnamed captures

Parameters

string $regexp

Return Value

string[]

at line 211
static array parse(string $regexp)

No description

Parameters

string $regexp

Return Value

array