PHP Class ParallelRegex, simpletest

Any of the contained patterns could match and when one does, it's label is returned.
Afficher le fichier Open project: simpletest/simpletest Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( boolean $case ) Constructor. Starts with no patterns.
addPattern ( string $pattern, string $label = true ) Adds a pattern with an optional label.
match ( string $subject, string &$match ) : boolean Attempts to match all patterns at once against a string.

Méthodes protégées

Méthode Description
getCompoundedRegex ( ) Compounds the patterns into a single regular expression separated with the "or" operator.
getPerlMatchingFlags ( ) : string Accessor for perl regex mode flags to use.

Method Details

__construct() public méthode

Constructor. Starts with no patterns.
public __construct ( boolean $case )
$case boolean True for case sensitive, false for insensitive.

addPattern() public méthode

Adds a pattern with an optional label.
public addPattern ( string $pattern, string $label = true )
$pattern string Perl style regex, but ( and ) lose the usual meaning.
$label string Label of regex to be returned on a match.

getCompoundedRegex() protected méthode

Caches the regex. Will automatically escape (, ) and / tokens.
protected getCompoundedRegex ( )

getPerlMatchingFlags() protected méthode

Accessor for perl regex mode flags to use.
protected getPerlMatchingFlags ( ) : string
Résultat string Perl regex flags.

match() public méthode

Attempts to match all patterns at once against a string.
public match ( string $subject, string &$match ) : boolean
$subject string String to match against.
$match string First matched portion of subject.
Résultat boolean True on success.