My text file contains 2 lines:
<IMG SRC="/icons/folder.gif" ALT="[DIR]"> <A HREF="yahoo.com.jp/">yahoo.com.jp/</A> </PRE><HR>
In my Perl script, I have:
my $String =~ /.*(HREF=")(.*)(">)/; print "$2";
and my output is the following:
Output 1: yahoo.com.jp Output 2: ><HR>
What I am trying to achieve is have my Perl script automatically extract the string inside the
As I am very new to regex, I want to ask if my regex is a badly formed one? If so can someone provide some suggestion to make it look nicer?
Secondly, I do not know why my second output is
"><HR>", I thought the expected behavior is that output2 will be skipped since it does not contain HREF=". Obviously I am very wrong.
Thanks for the help.