note
wind
<p>Putting aside the very odd goal...</p>
<p>The following regex will work for you.</p>
By using a look behind assertion <code>\K</code> and a look ahead assertion, we can simply inject " selected" into the appropriate option:
<code>
$selection =~ s/<option [^>]*\K(?=>\s*\Q$value\E\b)/ selected/;
</code>
1091782
1091782