Example #1
0
 /**
  * @covers Phossa\RegEx\RegEx::escapedChar
  */
 public function testEscapedChar()
 {
     // pattern, non-literal input
     $regex = RegEx::escapedChar('[a-z]', RegExOption::OPTION_DEFAULT_REG);
     $pattern = Utility::toPattern($regex);
     // actually 'a \b \\c \\\d \\\\e'
     $str1 = 'a \\b \\\\c \\\\\\d \\\\\\\\e';
     $this->assertEquals(2, preg_match_all($pattern, $str1, $m));
     $this->assertEquals('\\d', $m[0][1]);
 }