PregEngine

Implements \RegexpEngine

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

Methods

Sets pattern modifiers for regex engine

setModifiers(string $mods) : void

Arguments

$mods

string

Modifiers to be applied to a given regex

Gets pattern modifiers.

getModifiers() : string

Response

string

Sets whether or not regex operation is case sensitive.

setIgnoreCase(boolean $bit) : void

Arguments

$bit

boolean

Gets whether or not regex operation is case sensitive.

getIgnoreCase() : boolean

Response

boolean

Sets whether regexp should be applied in multiline mode.

setMultiline(boolean $bit) 

Arguments

$bit

boolean

Gets whether regexp is to be applied in multiline mode.

getMultiline() : boolean

Response

boolean

The pattern needs to be converted into PREG style -- which includes adding expression delims & any flags, etc.

preparePattern(string $pattern) : string

Arguments

$pattern

string

Response

string

prepared pattern.

Matches pattern against source string and sets the matches array.

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

Arguments

$pattern

string

The regex pattern to match.

$source

string

The source string.

$matches

array

The array in which to store matches.

Response

boolean

Success of matching operation.

Matches all patterns in source string and sets the matches array.

matchAll(string $pattern, string $source, array $matches) : boolean

Arguments

$pattern

string

The regex pattern to match.

$source

string

The source string.

$matches

array

The array in which to store matches.

Response

boolean

Success of matching operation.

Replaces $pattern with $replace in $source string.

replace(string $pattern, string $replace, string $source) : string

References to \1 group matches will be replaced with more preg-friendly $1.

Arguments

$pattern

string

The regex pattern to match.

$replace

string

The string with which to replace matches.

$source

string

The source string.

Response

string

The replaced source string.

Properties

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

ignoreCase : boolean
var

Type(s)

boolean

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

multiline : boolean
var

Type(s)

boolean

Pattern modifiers

modifiers : string
link

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

var

Type(s)

string