----- Original Message ----- From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, February 16, 2006 2:08 PM
Subject: Regular expression ;-)


Hello,

a simple regular expression is needed to eliminate the file extension:

$_="123";
/(XX)YY/;
print "$1\n" ; # result: "123";

$_="123.txt";
/(XX)YY/;
print "$1\n" ; # result: "123"

$_="123.txt.txt";
/(XX)YY/;
print "$1\n" ; # result: "123.txt";

Any suggestions for /(XX)YY/ ? Thanks.


Maybe
/^(.*)\..*$/;

Tested in Komodo Regexp calculator.

Petr Vileta, Czech republic
(My server reject all messages from Yahoo and Hotmail. Send me your mail from another non-spammer site please.)


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to