Thanks, all! Wow... being new to this world and this list, your generous
cameraderie blows me away!

Eric's solution (with the addition of a missing closing parens) works and is
the simplest for this newbie to deal with. Here it is in it's entirety:

if ($file_name !~ /(tif$|tiff$|jpg$|jpeg$)/i {}

I'll study some of the more arcane suggestions and discussions when time
allows to see if there is indeed a more elegant solution, but I wanted to
let you know that I do have something that works now.

Thanks again!

Jeffrey Paul Burger
2675 W. Hwy. 89A - PMB 455
Sedona, AZ 86336
928-203-0170

"There are only two ways to live your life.
One is as though nothing is a miracle.
The other is as if everything is."
                                    --Albert Einstein



> From: Eric Walker <[EMAIL PROTECTED]>
> Organization: Micron Technologies
> Reply-To: <[EMAIL PROTECTED]>
> Date: Mon, 6 Dec 2004 17:13:54 -0700
> To: <[EMAIL PROTECTED]>
> Cc: Jeffrey Paul Burger <[EMAIL PROTECTED]>
> Subject: Re: Trouble with compound regular expression matching
> 
> On Monday 06 December 2004 05:05 pm, Jeffrey Paul Burger wrote:
>> I tried everything I could think of to get this to work before pleading for
>> help!
>> 
>> I need to check if a file is either a TIFF or JPEG graphics file.
>> (Case-insensitive variations of qualifying suffixes would be .tif, .tiff,
>> .jpg and .jpeg.) So far I have three difference versions of what seem to be
>> a valid line of code to test a single pattern. ($file_name holds the name
>> of the file. Also, for logic reasons, I'm testing that it's NOT one of
>> these types):
>> 
>> if ($file_name !~ /tif$/i) {}
>> 
>> if ($file_name !~ m/tif\b/i) {}
>> 
>> if ($file_name !~ m/.*.tif/i) {}
>> 
>> But I can't for the life of me figure out how to structure a working
>> version of a more complex variation on any of the these that test all four
>> cases (or even a second one, for that matter). From my reading, I would
>> expect the following to work, but it doesn't:
>> 
>> if ($file_name !~ /tif$/i | /jpg$/i) {}
>> 
>> Any help would be greatly appreciated.
>> 
>> Thanks!
>> 
>> Jeffrey Paul Burger
>> 2675 W. Hwy. 89A - PMB 455
>> Sedona, AZ 86336
>> 928-203-0170
>> 
>> "There are only two ways to live your life.
>> One is as though nothing is a miracle.
>> The other is as if everything is."
>>                                     --Albert Einstein
> I am no professional but try this one.
> if ($file_name !~ /(tif$|jpg$)/i {}
> 
> cross your fingers...
> perl newbie....
> 
> 
> 
> -- 
> Eric Walker -- <br>
> CAD Engineer <br>
> X82573 <br>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to