Surely not perfect but this seems to work...

$lin = "2011/05/25 07:24:58 -0700 PDT";
$lin =~ /(^\d+\/\d+\/\d+).*/;
print "$1\n";



Marco van Kammen
 Applicatiebeheerder




Mirabeau | Managed Services    Dr. C.J.K. van Aalstweg 8F 301, 1625 NV Hoorn
+31(0)20-5950550  -  www.mirabeau.nl

 Please consider the environment before printing this email-----Original 
Message-----
From: Irfan Sayed [mailto:irfan_sayed2...@yahoo.com]
Sent: Wednesday, May 25, 2011 4:39 PM
To: Perl Beginners
Subject: reg exp

hi,

i have string like this
"2011/05/25 07:24:58 -0700 PDT"  i need to match "2011/05/25"
i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working

code is like this


$lin = "2011/05/25 07:24:58 -0700 PDT";
$lin =~ m/^\d\d\d\d//\d\d/\d\d$/;
print "$lin\n";

plz suggest

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to