List Info

Thread: Regular expression ;-)




Regular expression ;-)
user name
2006-02-16 17:28:48
----- Original Message ----- 
From: <Walter.Laubschwindt.net>
To: <ActivePerllistserv.ActiveState.com>
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
ActivePerllistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )