Class ParallelRegex

Description

Compounded regular expression. Any of the contained patterns could match and when one does it's label is returned.

Located in /libraries/pear/simpletest/parser.php (line 26)


	
			
Variable Summary
 mixed $_case
 mixed $_labels
 mixed $_patterns
 mixed $_regex
Method Summary
 ParallelRegex ParallelRegex (boolean $case)
 void addPattern (string $pattern, [string $label = true])
 boolean match (string $subject, string &$match)
 void _getCompoundedRegex (array $patterns)
Variables
mixed $_case (line 30)
mixed $_labels (line 28)
mixed $_patterns (line 27)
mixed $_regex (line 29)
Methods
Constructor ParallelRegex (line 38)

Constructor. Starts with no patterns.

  • access: public
ParallelRegex ParallelRegex (boolean $case)
  • boolean $case: True for case sensitive, false for insensitive.
addPattern (line 53)

Adds a pattern with an optional label.

  • access: public
void addPattern (string $pattern, [string $label = true])
  • string $pattern: Perl style regex, but ( and ) lose the usual meaning.
  • string $label: Label of regex to be returned on a match.
match (line 69)

Attempts to match all patterns at once against a string.

  • return: True on success.
  • access: public
boolean match (string $subject, string &$match)
  • string $subject: String to match against.
  • string $match: First matched portion of subject.
_getCompoundedRegex (line 94)

Compounds the patterns into a single regular expression separated with the "or" operator. Caches the regex.

Will automatically escape (, ) and / tokens.

  • access: private
void _getCompoundedRegex (array $patterns)
  • array $patterns: List of patterns in order.
_getPerlMatchingFlags (line 112)

Accessor for perl regex mode flags to use.

  • return: Perl regex flags.
  • access: private
string _getPerlMatchingFlags ()

Documentation generated on Fri, 24 Dec 2004 13:02:59 +0000 by phpDocumentor 1.3.0RC3