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 ( #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
Node Status?
node history
Node Type: note [id://346992]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2019-08-24 21:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?