Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Getting File Type using Regular Expressions

by kvale (Monsignor)
on Apr 21, 2004 at 13:11 UTC ( [id://346992]=note: print w/replies, xml ) Need Help??


in reply to Getting File Type using Regular Expressions

Welcome to the wonderful world of regexes! To learn more about regular expressions, check out my perlrequick tutorial.

With reference to your particular question, alternation will help here:

if ($filename =~ /\.(jpg|gif|bmp|doc|txt)$/ { print "Found a match\n"; }

-Mark

Replies are listed 'Best First'.
Re: Re: Getting File Type using Regular Expressions
by bkiahg (Pilgrim) on Apr 21, 2004 at 13:36 UTC
    Thanks for the online tutorials guys. Will definitely read up on them.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-25 12:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found