You can force the regex engine to start looking for </a> at the end of the string and work forwards
by consuming all the string to start with and backtracking character by character:
my $string = q!Back to STATES Menu</font></a></h3> <p align="center"><
+a href="index.htm"><img src="home2.gif" alt="Home" border="0" width="
+106" height="30"></a></p> </body> </html>!;
if ( $string =~ m!^.*(</a>.*?)$! ) {
print "got $1\n";
}
but there's usually a better way to get what you want done.
|