# classes/phing/util/regexp/Regexp.php

A factory class for regex functions.

author
  Hans Lellelid
package
  phing.util.regexp
version
  $Revision: 1084 $

## \Regexp
jump to top

A factory class for regex functions.

author
  Hans Lellelid
package
  phing.util.regexp
version
  $Revision: 1084 $

### Properties

`\RegexpEngine $engine= ''`

The regex engine -- e.g. 'preg' or 'ereg';

Details

Type
  \RegexpEngine

`array $groups= 'array'`

Matching groups found.

Default value `array` Details

Type
  array

`string $pattern= ''`

Pattern to match.

Details

Type
  string

`string $replace= ''`

Replacement pattern.

Details

Type
  string

### Methods

`__construct( $engineType = preg ) :`
Constructor sets the regex engine to use (preg by default).
Parameters

Name | Type | Description
--- | --- | ---
$engineType |  |

`getGroup( integer $idx ) : string`
Get specific matched group.
Parameters

Name | Type | Description
--- | --- | ---
$idx | integer |

Returns

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

`getGroups( ) : array`
Get array of matched groups.
Returns

Type | Description
--- | ---
array |

`getIgnoreCase( ) : boolean`
Gets whether the regexp matching is case insensitive.
Returns

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

`getModifiers( ) : string`
Gets pattern modifiers.

Subsequent call to engines getModifiers() filters out duplicates i.e. if i is provided in $mods, and setIgnoreCase(true), "i" modifier would be included only once

Returns

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

`getMultiline( ) : boolean`
Gets whether regexp is to be applied in multiline mode.
Returns

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

`getPattern( ) : string`
Gets pattern to use for matching.
Returns

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

`getReplace( ) : string`
Gets replacement string.
Returns

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

`matches( string $subject ) : boolean`
Performs match of specified pattern against $subject.
Parameters

Name | Type | Description
--- | --- | ---
$subject | string | The subject, on which to perform matches.

Returns

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

`replace( string $subject ) : string`
Performs replacement of specified pattern and replacement strings.
Parameters

Name | Type | Description
--- | --- | ---
$subject | string | Text on which to perform replacement.

Returns

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

`setIgnoreCase( boolean $bit ) :`
Sets whether the regexp matching is case insensitive.

(default is false -- i.e. case sensisitive)

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 ) :`
Sets whether regexp should be applied in multiline mode.
Parameters

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

`setPattern( string $pat ) : void`
Sets pattern to use for matching.
Parameters

Name | Type | Description
--- | --- | ---
$pat | string | The pattern to match on.

`setReplace( string $rep ) : void`
Sets replacement string.
Parameters

Name | Type | Description
--- | --- | ---
$rep | string | The pattern to replace matches with.

Documentation was generated by DocBlox 0.13.1.