\Symfony\Component\FinderGlob

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.

Summary

Methods
Properties
Constants
toRegex()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

toRegex()

toRegex(string  $glob, boolean  $strictLeadingDot = true, boolean  $strictWildcardSlash = true, string  $delimiter = '#') : string

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

Parameters

string $glob

The glob pattern

boolean $strictLeadingDot
boolean $strictWildcardSlash
string $delimiter

Optional delimiter

Returns

string —

regex The regexp