http://www.perlmonks.org?node_id=1002499


in reply to Re^2: trouble with regular expressions
in thread trouble with regular expressions

my old code matches the ;doc and gives result such as ssscument.write('<iframe ...shortened...</iframe>');

No, it does not:

use 5.010; use strict; use warnings; $_ = q[;document.write('<iframe src="any url" scrolling="auto" framebo +rder="no" align="center" height="15" width="15"></iframe>');]; s/(\;do.*)(\<\/iframe\>\'\)\;)/sss/; say __END__ sss

Anyway, it's easier if you use a different delimiter so that you don't have to escape the forward slashes:

s{(\;do.*)(</iframe>'\);)}{//eof};