Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Regex for zip files.

by Karger78 (Beadle)
on Jun 09, 2009 at 21:08 UTC ( [id://770098]=note: print w/replies, xml ) Need Help??


in reply to Regex for zip files.

Ok here is the issue. That one code posted doesn't match anything. My array contains zip files and zip.meta files. With my orignal code it matches the zip on the first pass, then on the 2nd it matches zip and zip.meta. I would like it to match zip if it's just a zip at the end, or just match zip.meta if that's found within the array.

Replies are listed 'Best First'.
Re^2: Regex for zip files.
by Marshall (Canon) on Jun 09, 2009 at 21:31 UTC
    As a suggestion, try this:
    my @zips = grep { /\.zip$/} @uploads; my @meta = grep {/zip\.meta$/} @uploads; # "Your Mother" pointed out that I had meta/$ instead # of the correction shown. .meta$/} Oooops. print "zips= @zips\n"; print "zipmeta= @meta\n";
    Update: Something like this might work.
    foreach my $upload (@uploads) { if ($upload =~ m/zip$/i) { print "I GOT A ZIP\n"; } elsif ($upload =~ m/zip\.meta$/i) { print "I GOT A META\n" } else { print "I got NADA" } }
Re^2: Regex for zip files.
by Popcorn Dave (Abbot) on Jun 10, 2009 at 01:11 UTC
    If that's the case, you need to provide a sample of your data and show what's not working.


    To disagree, one doesn't have to be disagreeable - Barry Goldwater

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://770098]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (1)
As of 2024-04-19 00:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found