[ Index ]

PHP Cross Reference of DokuWiki




/inc/Parsing/Lexer/ -> ParallelRegex.php (summary)

Lexer adapted from Simple Test: http://sourceforge.net/projects/simpletest/ For an intro to the Lexer see: https://web.archive.org/web/20120125041816/http://www.phppatterns.com/docs/develop/simple_test_lexer_notes

Author: Marcus Baker http://www.lastcraft.com
File Size: 203 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ParallelRegex:: (6 methods):

Class: ParallelRegex  - X-Ref

Compounded regular expression.

Any of the contained patterns could match and when one does it's label is returned.
__construct($case)   X-Ref
Constructor. Starts with no patterns.

param: boolean $case    True for case sensitive, false

addPattern($pattern, $label = true)   X-Ref
Adds a pattern with an optional label.

param: mixed       $pattern Perl style regex. Must be UTF-8
param: bool|string $label   Label of regex to be returned

match($subject, &$match)   X-Ref
Attempts to match all patterns at once against a string.

param: string $subject      String to match against.
param: string $match        First matched portion of
return: bool|string         False if no match found, label if label exists, true if not

split($subject, &$split)   X-Ref
Attempts to split the string against all patterns at once

param: string $subject      String to match against.
param: array $split         The split result: array containing, pre-match, match & post-match strings
return: boolean             True on success.
author: Christopher Smith <chris@jalakai.co.uk>

getCompoundedRegex()   X-Ref
Compounds the patterns into a single
regular expression separated with the
"or" operator. Caches the regex.
Will automatically escape (, ) and / tokens.

return: null|string

getPerlMatchingFlags()   X-Ref
Accessor for perl regex mode flags to use.

return: string       Perl regex flags.