util/regexp/PregEngine.php
PREG Regexp Engine.
Implements a regexp engine using PHP's preg_match(), preg_match_all(), and preg_replace() functions.
- Author
- hans lellelid, hans@velum.net
- Package
- phing.util.regexp
\PregEngine
PREG Regexp Engine.
Implements a regexp engine using PHP's preg_match(), preg_match_all(), and preg_replace() functions.
- Parent(s)
- \RegexpEngine
- Author
- hans lellelid, hans@velum.net
Properties


boolean
$ignoreCase= 'null'
Set to null by default to distinguish between false and not set
null
Details- Type
- boolean


string
$modifiers= 'null'
Pattern modifiers
null
Details- Type
- string
- Link
- http://php.net/manual/en/reference.pcre.pattern.modifiers.php
Methods


getIgnoreCase(
)
:
boolean
Gets whether or not regex operation is case sensitive.
Type | Description |
---|---|
boolean |


getMultiline(
)
:
boolean
Gets whether regexp is to be applied in multiline mode.
Type | Description |
---|---|
boolean |


match(
string $pattern, string $source, array $matches
)
:
boolean
Matches pattern against source string and sets the matches array.
Name | Type | Description |
---|---|---|
$pattern | string | The regex pattern to match. |
$source | string | The source string. |
$matches | array | The array in which to store matches. |
Type | Description |
---|---|
boolean | Success of matching operation. |


matchAll(
string $pattern, string $source, array $matches
)
:
boolean
Matches all patterns in source string and sets the matches array.
Name | Type | Description |
---|---|---|
$pattern | string | The regex pattern to match. |
$source | string | The source string. |
$matches | array | The array in which to store matches. |
Type | Description |
---|---|
boolean | Success of matching operation. |


preparePattern(
string $pattern
)
:
string
The pattern needs to be converted into PREG style -- which includes adding expression delims & any flags, etc.
Name | Type | Description |
---|---|---|
$pattern | string |
Type | Description |
---|---|
string | prepared pattern. |


replace(
string $pattern, string $replace, string $source
)
:
string
Replaces $pattern with $replace in $source string.
References to \1 group matches will be replaced with more preg-friendly $1.
Name | Type | Description |
---|---|---|
$pattern | string | The regex pattern to match. |
$replace | string | The string with which to replace matches. |
$source | string | The source string. |
Type | Description |
---|---|
string | The replaced source string. |


setIgnoreCase(
boolean $bit
)
:
void
Sets whether or not regex operation is case sensitive.
Name | Type | Description |
---|---|---|
$bit | boolean |


setModifiers(
string $mods
)
:
void
Sets pattern modifiers for regex engine
Name | Type | Description |
---|---|---|
$mods | string | Modifiers to be applied to a given regex |