hmmm, sorry. That "]" is not in my original code and it's not the problem.... i just made a mistake when writing the code here in the email.


It's cool to know that it worked fine in your computer, i guess i did it right the first time. Somehow it doesn't work, i will keep looking at it.

A questio: Should the 'split' version of the same code be faster?

----Original Message Follows----
From: "Kipp, James" <[EMAIL PROTECTED]>
To: "'Marcelo Taube'" <[EMAIL PROTECTED]>,      [EMAIL PROTECTED]
Subject: RE: Problem with regular expressions!!!
Date: Tue, 18 Mar 2003 16:47:20 -0500

>
> This is the code.
> #####################################
> $file_completename =~ /(.*?)\.(.*)/;
> if ($2 eq $extension]) {
>   #DO SOMETHING!!!
> }
> #####################################

did u turn on warnings and use strict ??
did you catch the ] at the end of $extension?

i tried this on my machine and it works fine:
$fn = "test.jpg";
if ($fn =~ /(.*?)\.(.*)/ ) { print "$2" }
# prints jpg


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail



-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to