References: <[email protected]>
Try something like this, perhaps:
$x ~~ s:i/ ^ (.*?) '</a>' .*? '<a href="' (.*?) $ /$0 $1/;
Some explanations:
s:i
The :i modifier makes it case insensitive, so data with upper-case
html won't break things.
In general, you want to break it down into chunks, and just keep the
chunks you want.
^ begin matching at the start of the string
(.*?) match anything up to the next pattern, *and* capture it to a variable
'...' I'm using single quotes on the literal strings
$ match all the way to the end of the string.
Pinning the match with ^ and $ means a s/// will replace the entire string.
There are two captures, so they load $0 and $1, and here we're using
them in the replace string: s/.../$0 $1/