in reply to Re: Re: extracting regex into, and interpolating, variable
in thread extracting regex into, and interpolating, variable

Hi, having read your post a little more carefully, I think maybe this is a bit closer to what you want. $1 holds the match after "value=".
use strict; my $line = qq(<textarea type="text" value="foo" name="text_message" /> +&nbsp;<%bar%>&nbsp;</p>); if ($line =~ /<textarea .+ value="(.+?)".+(<%.+%>)/) { my $foo = $1; my $bar = $2; $line =~ s/<textarea/<input/; $line =~ s/$bar/$foo/; print $line; }