match() public method

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.
return boolean True on success.
Ejemplo n.º 1
0
 function testPatternLabels()
 {
     $regex = new ParallelRegex(false);
     $regex->addPattern("abc", "letter");
     $regex->addPattern("123", "number");
     $this->assertIdentical($regex->match("abcdef", $match), "letter");
     $this->assertEqual($match, "abc");
     $this->assertIdentical($regex->match("0123456789", $match), "number");
     $this->assertEqual($match, "123");
 }
Ejemplo n.º 2
0
 public function testPatternLabels()
 {
     $regex = new ParallelRegex(false);
     $regex->addPattern('abc', 'letter');
     $regex->addPattern('123', 'number');
     $this->assertIdentical($regex->match('abcdef', $match), 'letter');
     $this->assertEqual($match, 'abc');
     $this->assertIdentical($regex->match('0123456789', $match), 'number');
     $this->assertEqual($match, '123');
 }
Ejemplo n.º 3
0
 public function testWithTextInLatin1()
 {
     $regex = new ParallelRegex(false);
     $regex->addPattern(utf8_decode('eé'));
     $this->assertTrue($regex->match(utf8_decode('eéêè'), $match));
     $this->assertEqual($match, utf8_decode('eé'));
 }