in reply to Replacing everything in between using s///;
If you want to replace a substring bounded by other substrings:
my $alpha = join '', ('a'..'z'); # $alpha = 'abcdefghijklmnopqrstuvwx +yz' $alpha =~ s/(?<=def).*(?=uvw)//; # remove everything preceeded by the + substring 'def' # and succeeded by the substring ' +uvw' print $alpha; # $alpha = 'abcdefuvwxyz'
Consult perlre and perlretut for more on the formation of regular expressions; however, given your example using HTML, I presume you may really be looking for HTML::Template and similar modules.
|
|---|