#!/usr/bin/perl -w
use strict;
my ($data, $res);
$data = 'test<\a>';
print "Before substitution: $data\n";
$res = $data =~ s/
( # Capture to $1 ]* # stuff between a and href
)
(
href\s* # href followed by spaces
)
(
=\s* # Equals followed by spaces
(
["']+ # Open quote character
)
(
[^"']+ # Non open quote character
)
(?:
\4 # Close quote character
)
)
(
> # Not final close angle bracket
)
(
[^>]+ # Up to closing angle bracket
> # Final close angle bracket
)
/$1$2$3$6$7/x;
print "no match\n" if ($res eq "");
print "After substitution: $data\n";