in reply to replacing chunks of text only if another chunk matches a pattern
The regex might need a bit of upgrading, but it should work fine if your pages don't have sloppy HTML syntax (leaving out one or both ").while ($body_str =~ /"http:\/\/([^ \/"]+)[^ "]*"/g) { if ($1 ne 'www.danheller.com') { $pos = pos($body_str); substr($body_str, $pos - 1, 1) = '" target="blank"'; pos($body_str) = $pos; } }
|
|---|