From: Vincent Pit Date: Sun, 29 Jun 2008 15:43:54 +0000 (+0200) Subject: Importing Regexp-Wildcards-0.05.tar.gz X-Git-Tag: v0.05^0 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FRegexp-Wildcards.git;a=commitdiff_plain;h=03007c83b1d852b1f2120c7aa500c36607d30e72 Importing Regexp-Wildcards-0.05.tar.gz --- diff --git a/Changes b/Changes index 421a0e2..4571df6 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ Revision history for Regexp-Wildcards +0.05 2007-06-22 14:40 UTC + + Add : Windows strange behaviours caveat. + + Chg : Simplified bracket prefix. + + Fix : Typos in pod. + 0.04 2007-06-20 19:00 UTC + Add : You can supply $^O as the type for wc2re, which will wrap to wc2re_win32 for 'dos', 'os2', 'MSWin32', 'cygwin', and to diff --git a/META.yml b/META.yml index 10dd95b..49ecc79 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: Regexp-Wildcards -version: 0.04 +version: 0.05 abstract: Converts wildcard expressions to Perl regular expressions. license: perl generated_by: ExtUtils::MakeMaker version 6.32 diff --git a/README b/README index c7bd794..5f22332 100644 --- a/README +++ b/README @@ -3,15 +3,15 @@ NAME expressions. VERSION - Version 0.04 + Version 0.05 SYNOPSIS use Regexp::Wildcards qw/wc2re/; my $re; - $re = wc2re 'a{b.,c}*' => 'unix'; # Do it Unix style. - $re = wc2re 'a.,b*' => 'win32'; # Do it Windows style. - $re = wc2re '*{x,y}.' => 'jokers'; # Process the jokers & escape the rest. + $re = wc2re 'a{b?,c}*' => 'unix'; # Do it Unix style. + $re = wc2re 'a?,b*' => 'win32'; # Do it Windows style. + $re = wc2re '*{x,y}?' => 'jokers'; # Process the jokers & escape the rest. DESCRIPTION In many situations, users may want to specify patterns to match but @@ -26,14 +26,14 @@ VARIABLES These variables control if the wildcards jokers and brackets must capture their match. They can be globally set by writing in your program - $Regexp::Wildcards::CaptureAny = -1; - # From then, '*' jokers are capturing + $Regexp::Wildcards::CaptureSingle = 1; + # From then, the '?' joker is capturing or can be locally specified via "local" { - local $Regexp::Wildcards::CaptureAny = -1; - # In this block, the '*' joker is capturing. + local $Regexp::Wildcards::CaptureAny = 1; + # In this block, the '?' joker is capturing. ... } # Back to the situation from before the block @@ -138,6 +138,12 @@ EXPORT DEPENDENCIES Text::Balanced, which is bundled with perl since version 5.7.3 +CAVEATS + This module does not implement the strange behaviours of Windows shell + that result from the special handling of the three last characters (for + the file extension). For example, Windows XP shell matches *a like + ".*a", "*a?" like ".*a.?", "*a??" like ".*a.{0,2}" and so on. + SEE ALSO Some modules provide incomplete alternatives as helper functions : diff --git a/lib/Regexp/Wildcards.pm b/lib/Regexp/Wildcards.pm index d4b1cb3..a361176 100644 --- a/lib/Regexp/Wildcards.pm +++ b/lib/Regexp/Wildcards.pm @@ -11,20 +11,20 @@ Regexp::Wildcards - Converts wildcard expressions to Perl regular expressions. =head1 VERSION -Version 0.04 +Version 0.05 =cut -our $VERSION = '0.04'; +our $VERSION = '0.05'; =head1 SYNOPSIS use Regexp::Wildcards qw/wc2re/; my $re; - $re = wc2re 'a{b.,c}*' => 'unix'; # Do it Unix style. - $re = wc2re 'a.,b*' => 'win32'; # Do it Windows style. - $re = wc2re '*{x,y}.' => 'jokers'; # Process the jokers & escape the rest. + $re = wc2re 'a{b?,c}*' => 'unix'; # Do it Unix style. + $re = wc2re 'a?,b*' => 'win32'; # Do it Windows style. + $re = wc2re '*{x,y}?' => 'jokers'; # Process the jokers & escape the rest. =head1 DESCRIPTION @@ -34,14 +34,14 @@ In many situations, users may want to specify patterns to match but don't need t These variables control if the wildcards jokers and brackets must capture their match. They can be globally set by writing in your program - $Regexp::Wildcards::CaptureAny = -1; - # From then, '*' jokers are capturing + $Regexp::Wildcards::CaptureSingle = 1; + # From then, the '?' joker is capturing or can be locally specified via C { - local $Regexp::Wildcards::CaptureAny = -1; - # In this block, the '*' joker is capturing. + local $Regexp::Wildcards::CaptureAny = 1; + # In this block, the '?' joker is capturing. ... } # Back to the situation from before the block @@ -201,6 +201,10 @@ our %EXPORT_TAGS = ( all => [ @EXPORT_OK ] ); L, which is bundled with perl since version 5.7.3 +=head1 CAVEATS + +This module does not implement the strange behaviours of Windows shell that result from the special handling of the three last characters (for the file extension). For example, Windows XP shell matches C<*a> like C<.*a>, C<*a?> like C<.*a.?>, C<*a??> like C<.*a.{0,2}> and so on. + =head1 SEE ALSO Some modules provide incomplete alternatives as helper functions : @@ -238,7 +242,7 @@ under the same terms as Perl itself. =cut -sub extract { extract_bracketed shift, '{', qr/.*?(?:(?