Class Symfony\Component\Finder\Glob

InheritanceSymfony\Component\Finder\Glob

Glob matches globbing patterns against text.

if match_glob("foo.*", "foo.bar") echo "matched\n";

// prints foo.bar and foo.baz $regex = glob_to_regex("foo.*"); for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t) { if (/$regex/) echo "matched: $car\n"; }

Glob implements glob(3) style matching that can be used to match against text, rather than fetching names from a filesystem.

Based on the Perl Text::Glob module.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
toRegex() Returns a regexp which is the equivalent of the glob pattern. Symfony\Component\Finder\Glob

Method Details

toRegex() public static method

Returns a regexp which is the equivalent of the glob pattern.

public static string toRegex ( $glob, $strictLeadingDot true, $strictWildcardSlash true, $delimiter '#' )
$glob string

The glob pattern

$strictLeadingDot bool
$strictWildcardSlash bool
$delimiter string

Optional delimiter

return string

Regex The regexp