Documentation

Glob
in package

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 (['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.

Tags
author

Fabien Potencier fabien@symfony.com PHP port

author

Richard Clamp richardc@unixbeard.net Perl version

copyright

2004-2005 Fabien Potencier fabien@symfony.com

copyright

2002 Richard Clamp richardc@unixbeard.net

Table of Contents

Methods

toRegex()  : string
Returns a regexp which is the equivalent of the glob pattern.

Methods

toRegex()

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

public static toRegex(string $glob[, bool $strictLeadingDot = true ][, bool $strictWildcardSlash = true ][, string $delimiter = '#' ]) : string
Parameters
$glob : string

The glob pattern

$strictLeadingDot : bool = true
$strictWildcardSlash : bool = true
$delimiter : string = '#'

Optional delimiter

Return values
string

regex The regexp


        
On this page

Search results