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
nullDetails- Type
- boolean

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

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

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

match(
string $pattern, string $source, array $matches
)
:
booleanMatches 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
)
:
booleanMatches 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
)
:
stringThe 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
)
:
stringReplaces $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
)
:
voidSets whether or not regex operation is case sensitive.
| Name | Type | Description |
|---|---|---|
| $bit | boolean |

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