Пример #1
0
 /**
  * @param bool $strictLeadingDot
  * @param bool $strictWildcardSlash
  *
  * @return ehough_finder_expression_Regex
  */
 public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
 {
     $regex = ehough_finder_Glob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
     return new ehough_finder_expression_Regex($regex);
 }
Пример #2
0
 public function testGlobToRegexDelimiters()
 {
     $this->assertEquals('#^\\.[^/]*$#', ehough_finder_Glob::toRegex('.*'));
     $this->assertEquals('^\\.[^/]*$', ehough_finder_Glob::toRegex('.*', true, true, ''));
     $this->assertEquals('/^\\.[^/]*$/', ehough_finder_Glob::toRegex('.*', true, true, '/'));
 }
Пример #3
0
 /**
  * Converts glob to regexp.
  *
  * PCRE patterns are left unchanged.
  * ehough_finder_expression_Glob strings are transformed with ehough_finder_expression_Glob::toRegex().
  *
  * @param string $str Pattern: glob or regexp
  *
  * @return string regexp corresponding to a given glob or regexp
  */
 protected function toRegex($str)
 {
     return $this->isRegex($str) ? $str : ehough_finder_Glob::toRegex($str);
 }