2 Regexp::Wildcards - Converts wildcards to regexps.
8 use Regexp::Wildcards qw/wc2re/;
11 $re = wc2re 'a{b.,c}*' => 'unix';
12 $re = wc2re 'a.,b*' => 'win32';
15 This module converts wildcards expressions to Perl regular expressions.
16 It handles the "*" and "?" jokers, as well as Unix bracketed
17 alternatives "{,}", and uses the backspace ("\") as an escape character.
18 Wrappers are provided to mimic the behaviour of Windows and Unix shells.
21 Four functions are exported only on request : "wc2re", "wc2re_unix",
22 "wc2re_win32" and "wc2re_jokers".
26 This function takes as its only argument the wildcard string to process,
27 and returns the corresponding regular expression (or "undef" if the
28 source is invalid) according to standard Unix wildcard rules. It
29 successively escapes all regexp special characters that doesn't hold any
30 meaning for wildcards, turns jokers into their regexp equivalents, and
31 changes bracketed blocks into alternations. If brackets are unbalanced,
32 it will try to substitute as many of them as possible, and then escape
33 the remaining "{" and "}".
36 Similar to the precedent, but for Windows wildcards. Bracketed blocks
37 are no longer handled (which means that brackets will be escaped), but
38 you can still provide a comma-separated list of items.
41 This one only handles the "?" and "*" jokers.
44 A generic function that wraps around all the different rules. The first
45 argument is the wildcard expression, and the second one is the type of
46 rules to apply, currently either "unix", "win32" or "jokers". If the
47 type is undefined, it defaults to "unix".
50 Net::FTPServer has a method for that. Only jokers are translated, and
51 escaping won't preserve them.
53 File::Find::Match::Util has a "wildcar" function that compiles a
54 matcher. Only handles "*".
56 Text::Buffer has the "convertWildcardToRegex" class method that handles
60 Vincent Pit, "<perl at profvince.com>"
63 Please report any bugs or feature requests to "bug-regexp-wildcards at
64 rt.cpan.org", or through the web interface at
65 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Regexp-Wildcards>. I
66 will be notified, and then you'll automatically be notified of progress
67 on your bug as I make changes.
70 You can find documentation for this module with the perldoc command.
72 perldoc Regexp::Wildcards
75 Copyright 2007 Vincent Pit, all rights reserved.
77 This program is free software; you can redistribute it and/or modify it
78 under the same terms as Perl itself.