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
\.(tif|tiff|jpg|jpeg)$/) {
print "This is an image file.\n";
};
-Original Message-
From: Paul Ohashi [mailto:[EMAIL PROTECTED]
Sent: Monday, December 06, 2004 4:24 PM
To: [EMAIL PROTECTED]
Subject: FW: Trouble with compound regular expression matching
Hmmm.. I'm new to
Paul Ohashi [PO], on Monday, December 6, 2004 at 16:24 (-0800) made
these points:
PO> I did need to add the case-insensitivity to the regex:
PO>/^.*\.[tj][pi][gfe].*$/i
PO> That's better, I think.
I'm not sure if this is good solution, because it matches also those,
you won't:
tpg, tpf, tpe,
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
om: Paul Ohashi
Sent: Monday, 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 [mail
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,
> .
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
12 matches
Mail list logo