Movatterモバイル変換


[0]ホーム

URL:


 / 
Text-Glob-0.11
River stage four • 43 direct dependents • 1880 total dependents
/Text::Glob

NAME

Text::Glob - match globbing patterns against text

SYNOPSIS

use Text::Glob qw( match_glob glob_to_regex );print "matched\n" if match_glob( "foo.*", "foo.bar" );# prints foo.bar and foo.bazmy $regex = glob_to_regex( "foo.*" );for ( qw( foo.bar foo.baz foo bar ) ) {    print "matched: $_\n" if /$regex/;}

DESCRIPTION

Text::Glob implements glob(3) style matching that can be used to match against text, rather than fetching names from a filesystem. If you want to do full file globbing use the File::Glob module instead.

Routines

match_glob( $glob, @things_to_test )

Returns the list of things which match the glob from the source list.

glob_to_regex( $glob )

Returns a compiled regex which is the equivalent of the globbing pattern.

glob_to_regex_string( $glob )

Returns a regex string which is the equivalent of the globbing pattern.

SYNTAX

The following metacharacters and rules are respected.

* - match zero or more characters

a* matchesa,aa,aaaa and many many more.

? - match exactly one character

a? matchesaa, but nota, oraaa

Character sets/ranges

example.[ch] matchesexample.c andexample.h

demo.[a-c] matchesdemo.a,demo.b, anddemo.c

alternation

example.{foo,bar,baz} matchesexample.foo,example.bar, andexample.baz

leading . must be explicitly matched

*.foo does not match.bar.foo. For this you must either specify the leading . in the glob pattern (.*.foo), or set$Text::Glob::strict_leading_dot to a false value while compiling the regex.

* and? do not match the seperator (i.e. do not match/)

*.foo does not matchbar/baz.foo. For this you must either explicitly match the / in the glob (*/*.foo), or set$Text::Glob::strict_wildcard_slash to a false value while compiling the regex, or change the seperator that Text::Glob uses by setting$Text::Glob::seperator to an alternative value while compiling the the regex.

BUGS

The code uses qr// to produce compiled regexes, therefore this module requires perl version 5.005_03 or newer.

AUTHOR

Richard Clamp <richardc@unixbeard.net>

COPYRIGHT

Copyright (C) 2002, 2003, 2006, 2007 Richard Clamp. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

File::Glob, glob(3)

Module Install Instructions

To install Text::Glob, copy and paste the appropriate command in to your terminal.

cpanm

cpanm Text::Glob

CPAN shell

perl -MCPAN -e shellinstall Text::Glob

For more information on module installation, please visitthe detailed CPAN module installation guide.

Keyboard Shortcuts

Global
sFocus search bar
?Bring up this help dialog
GitHub
gpGo to pull requests
gigo to github issues (only if github is preferred repository)
POD
gaGo to author
gcGo to changes
giGo to issues
gdGo to dist
grGo to repository/SCM
gsGo to source
gbGo to file browse
Search terms
module: (e.g.module:Plugin)
distribution: (e.g.distribution:Dancer auth)
author: (e.g.author:SONGMU Redis)
version: (e.g.version:1.00)

[8]ページ先頭

©2009-2025 Movatter.jp