Gives output:$content = qq(<textarea class="FolderTxtArea" name="blah"><%=foo::doSo +mething%></textarea>); while ($content =~ m/(<textarea.*textarea>)/sg) { my $match = $&; my $varmatch; print "match: before ..... $match\n"; if( $match =~ m/(<%=.*?%>)/sg){ $varmatch = $1; print "varmatch: $varmatch\n"; pos $match ; #cut var tag $match=~ s/$varmatch//g; print "match: after .... $match\n"; $match=~ s/textarea/testinsert$varmatch/g; print "match: after testinsert .... $match\n"; } }
Are you sure you are looking at the output from your latest run?match: before ..... <textarea class="FolderTxtArea" name="blah"><%=foo +::doSomething%></textarea> varmatch: <%=foo::doSomething%> match: after .... <textarea class="FolderTxtArea" name="blah"></texta +rea> match: after testinsert .... <testinsert<%=foo::doSomething%> class=" +FolderTxtArea" name="blah"></testinsert<%=foo::doSomething%>>
In reply to Re: can't get $& to remove value in a substitution
by roik
in thread can't get $& to remove value in a substitution
by zusuki-san
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |