Stout, Joel R [SJR], on Tuesday, December 7, 2004 at 00:55 (-)
typed:
SJR> use File::Basename;
SJR> $fullname = "/usr/local/pics/sample.tiff"; #for example
SJR> ($file,$dir,$_) = fileparse($fullname, qr/\..*/);
SJR> if (/\.(tif|tiff|jpg|jpeg)$/) {
SJR> print "This is an image file.\n";
SJR
, December 06, 2004 4:19 PM
To: 'Jeffrey Paul Burger'
Subject: RE: Trouble with compound regular expression matching
This one worked for me:
/^.*\.[tj][pi][gfe].*$/
Hope this helps
- Paul
-Original Message-
From: Jeffrey Paul Burger [mailto:[EMAIL PROTECTED]
Sent: Monday,
Jeffrey Paul Burger [JPB], on Monday, December 06, 2004 at 17:05
(-0700) typed the following:
JPB> if ($file_name !~ /tif$/i) {}
JPB> if ($file_name !~ m/tif\b/i) {}
JPB> if ($file_name !~ m/.*.tif/i) {}
what about this:
print "PIC is $1" if ($file_name =~ /\.(tif?f|jpe?g)$/i);
--
...m8s, cu
: <[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
Sorry bout that blank email...
anyway... I thnk this would work
$filename =~ /(?:jpe?g$)|(?:tif?f$)/i
I think this one is wrong because you actually have
two patterns here...
if ($file_name !~ /tif$/i | /jpg$/i) {}
maybe you could try doing it like this..
if($file_name !~ /(tif$)|(jpg$)/i
no
--- Jeffrey Paul Burger <[EMAIL PROTECTED]> 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
> Okay, now I have to admit I'm also new to Perl, but I can adapt to change:
>
> /^.*\.[tj][pi][gfe].{0,1}$/i
>
> I threw in the quantifier to avoid what Felix exposed. Now, there's
> probably a hole in this somewhere, but it's got to be a small one...
>
> -Paul
>
Zeroth: It would better
---
From: Felix Li [mailto:[EMAIL PROTECTED]
Sent: Monday, December 06, 2004 4:38 PM
To: Paul Ohashi
Subject: Re: Trouble with compound regular expression matching
print "No!" if "i.tied.my.shoes" =~/^.*\.[tj][pi][gfe].*$/i;
- Original Message -
From: "Paul
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,
> .