PHP Класс ParallelRegex, simpletest

Any of the contained patterns could match and when one does, it's label is returned.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
getCompoundedRegex ( ) Compounds the patterns into a single regular expression separated with the "or" operator.
getPerlMatchingFlags ( ) : string Accessor for perl regex mode flags to use.

Описание методов

__construct() публичный Метод

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

addPattern() публичный Метод

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() защищенный Метод

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

getPerlMatchingFlags() защищенный Метод

Accessor for perl regex mode flags to use.
protected getPerlMatchingFlags ( ) : string
Результат string Perl regex flags.

match() публичный Метод

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.
Результат boolean True on success.