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.


#!/usr/local/bin/perl
$a="abcd <meta kdkdkd refresh kdkdk >";
$b="abcd <meta kdk>dkd refresh kdkdk >"; $a=~s/^.*<meta.*(^\>).*refresh//; print "a=$a\n"; print "b=$b\n";


Desired result is

a= kdkdk >
b="abcd <meta kdk>dkd refresh kdkdk >";

$ perl -le' my @x = ( "abcd <meta kdkdkd refresh kdkdk >", "abcd <meta kdk>dkd refresh kdkdk >" ); for ( @x ) { print; s/^.*<meta[^>]*refresh//; print; } ' abcd <meta kdkdkd refresh kdkdk > kdkdk > abcd <meta kdk>dkd refresh kdkdk > abcd <meta kdk>dkd refresh kdkdk >



John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to