in reply to how to use regular expressions read some string from a htm file
Hi, It is a smarter way to use modules instead of regular expressions when working with HTML files. But, if you are so particular in using regex, try this.
open (F1, "<$ARGV[0]") || die ("Can't open the file $ARGV[0]. $!\n");
while(<F1>)
{
print "$1\n" if ($_ =~ /<a href="([^"]+)">/)
}
close F1;
In the above script, I have the HTML file stored in the variable F1.
|
|---|