Tham, Philip wrote: > I need some help with the following regex problem. > > I am not able to achieve the desired result. > > The substitution should succeed only of the ">" is not present between > the string "<meta" and the word refresh. Tried round brackets, square > brackets question mark but none of the combinations are working. > > Thanks in advance > > Philip > > #!/usr/local/bin/perl > $a="abcd <meta kdkdkd refresh kdkdk >"; > $b="abcd <meta kdk>dkd refresh kdkdk >"; > $a=~s/^.*<meta.*(^\>).*refresh//; You need to change (^\>) to ([^\>]+). You need the character class otherwise you are looking for a ^> while [^\>]+ says to keep going until you hit a >.
Wags ;0 > print "a=$a\n"; > print "b=$b\n"; > > Desired result is > > a= kdkdk > > b="abcd <meta kdk>dkd refresh kdkdk >"; ******************************************************* This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. ******************************************************* -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>