[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[PATCH] Fix DosGlob to work with paths containing ()'s




The following patch allows DosGlob to match pathnames
containing a "(" or ")" eg. "Copy (*) of foobar".

NB. this currently generates an "Unmatched ( in regex" error:

 perl -e "use File::DosGlob; File::DosGlob::glob('Copy (*')


Thanks.

--- DosGlob.pm#17       2008-09-21 20:30:51.078125000 +0100
+++ DosGlob.pm  2008-09-21 20:31:52.765625000 +0100
@@ -66,7 +66,7 @@
        $head .= $sepchr unless $head eq '' or substr($head,-1) eq $sepchr;

        # escape regex metachars but not glob chars
-        $pat =~ s:([].+^\-\${}[|]):\\$1:g;
+        $pat =~ s:([].+^\-\${}[|()]):\\$1:g;
        # and convert DOS-style wildcards to regex
        $pat =~ s/\*/.*/g;
        $pat =~ s/\?/.?/g;




Follow-Ups from:
Shlomi Fish <shlomif@iglu.org.il>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]