Beckett Richard-qswi266 wrote: > use strict; > use warnings; > my $pat = "abcd<efgh>ijklmnop<qrst>uvwxyz"; > print "\$pat is $pat\n"; > $pat =~ /<(.*)>.*<(.*)>/;
You probably want to either make that non-greedy or use a different expression in case there are more <> in the string : /<(.*?)>.*<(.*?)>/; or /<([^>]+)>.*<([^>]+)>/; > my ($one, $two) = ($1, $2); > print "\$one is $one\n\$two is $two\n"; > > R. > >>-----Original Message----- >>From: [EMAIL PROTECTED] >>[mailto:[EMAIL PROTECTED] On >>Behalf Of Jutu Subramanian, Srinivasan (Cognizant) >>Sent: 05 November 2004 09:34 >>To: [EMAIL PROTECTED] >>Subject: regex in <> >> >> >> >>Hi, >>pattern: abcd<efgh>ijklmnop<qrst>uvwxyz >> >>>From the above pattern, How to find the parameter $1=efgh >>and $2=qrst within <>. What is the regex to written in perl? -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff) _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs