# 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
jump to top

Package: phing\util\regexp

PREG Regexp Engine.

Implements a regexp engine using PHP's preg_match(), preg_match_all(), and preg_replace() functions.

Implements
  \RegexpEngine
Author
  hans lellelid, hans@velum.net

### Properties

`boolean $ignoreCase= 'null'`

Set to null by default to distinguish between false and not set

Default value `null` Details

Type
  boolean

`string $modifiers= 'null'`

Pattern modifiers

Default value `null` Details

Type
  string
Link
  http://php.net/manual/en/reference.pcre.pattern.modifiers.php

`boolean $multiline= 'null'`

Set to null by default to distinguish between false and not set

Default value `null` Details

Type
  boolean

### Methods

`getIgnoreCase( ) : boolean`

Gets whether or not regex operation is case sensitive.

Returns

Type | Description
--- | ---
boolean |

`getModifiers( ) : string`

Gets pattern modifiers.

Returns

Type | Description
--- | ---
string |

`getMultiline( ) : boolean`

Gets whether regexp is to be applied in multiline mode.

Returns

Type | Description
--- | ---
boolean |

`match( string $pattern, string $source, array $matches ) : boolean`

Matches pattern against source string and sets the matches array.

Parameters

Name | Type | Description
--- | --- | ---
$pattern | string | The regex pattern to match.
$source | string | The source string.
$matches | array | The array in which to store matches.

Returns

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.

Parameters

Name | Type | Description
--- | --- | ---
$pattern | string | The regex pattern to match.
$source | string | The source string.
$matches | array | The array in which to store matches.

Returns

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.

Parameters

Name | Type | Description
--- | --- | ---
$pattern | string |

Returns

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.

Parameters

Name | Type | Description
--- | --- | ---
$pattern | string | The regex pattern to match.
$replace | string | The string with which to replace matches.
$source | string | The source string.

Returns

Type | Description
--- | ---
string | The replaced source string.

`setIgnoreCase( boolean $bit ) : void`

Sets whether or not regex operation is case sensitive.

Parameters

Name | Type | Description
--- | --- | ---
$bit | boolean |

`setModifiers( string $mods ) : void`

Sets pattern modifiers for regex engine

Parameters

Name | Type | Description
--- | --- | ---
$mods | string | Modifiers to be applied to a given regex

`setMultiline( boolean $bit ) : void`

Sets whether regexp should be applied in multiline mode.

Parameters

Name | Type | Description
--- | --- | ---
$bit | boolean |

Documentation was generated by DocBlox 0.15.1.