# Regexp

A factory class for regex functions.

author | Hans Lellelid hans@xmpl.org
package | phing.util.regexp
version | $Id: d2bfdbbcbc1f6e4b02c9c8796b476db46ee35728 $

### Methods

## Get specific matched group.

    getGroup(integer $idx) : string

### Arguments

#### $idx

`integer`

### Response

`string`

specified group or NULL if group is not set.

## Get array of matched groups.

    getGroups() : array

### Response

`array`

Matched groups

## Gets whether the regexp matching is case insensitive.

    getIgnoreCase() : boolean

### Response

`boolean`

## Gets pattern modifiers.

    getModifiers() : string

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

### Response

`string`

## Gets whether regexp is to be applied in multiline mode.

    getMultiline() : boolean

### Response

`boolean`

## Gets pattern to use for matching.

    getPattern() : string

### Response

`string`

The pattern to match on.

## Gets replacement string.

    getReplace() : string

### Response

`string`

The pattern to replace matches with.

## Performs match of specified pattern against $subject.

    matches(string $subject) : boolean

throws |

### Arguments

#### $subject

`string`

The subject, on which to perform matches.

### Response

`boolean`

Whether or not pattern matches subject string passed.

## Performs replacement of specified pattern and replacement strings.

    replace(string $subject) : string

throws |

### Arguments

#### $subject

`string`

Text on which to perform replacement.

### Response

`string`

subject after replacement has been performed.

## Sets whether the regexp matching is case insensitive.

    setIgnoreCase(boolean $bit)

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

### Arguments

#### $bit

`boolean`

## Sets pattern modifiers for regex engine

    setModifiers(string $mods) : void

### Arguments

#### $mods

`string`

Modifiers to be applied to a given regex

## Sets whether regexp should be applied in multiline mode.

    setMultiline(boolean $bit)

### Arguments

#### $bit

`boolean`

## Sets pattern to use for matching.

    setPattern(string $pat) : void

### Arguments

#### $pat

`string`

The pattern to match on.

## Sets replacement string.

    setReplace(string $rep) : void

### Arguments

#### $rep

`string`

The pattern to replace matches with.

### Properties

## Matching groups found.

    groups : array

var |

### Type(s)

`array`

## Pattern to match.

    pattern : string

var |

### Type(s)

`string`

## Replacement pattern.

    replace : string

var |

### Type(s)

`string`

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

    engine : \RegexpEngine

var |

### Type(s)

`\RegexpEngine`