I have a function that parses an html page and extract phone numbers.. the problem is it matches lines of numbers that are part of HTML tags.. which I want to exclude. Here is how I get around it:
The problem with the second line is that if the $1 contains characters that aren't escaped (but should be). It causes my application to crash.
Is there a perl function escape($1) or another way to do this?
Code:
while($html=~/((\d{3})[\s-\(\)\.]*(\d{3})[\s-\(\)\.]*(\d{4}))/g){
if ($html !~ /\<.+$1.+\>/){
The problem with the second line is that if the $1 contains characters that aren't escaped (but should be). It causes my application to crash.
Is there a perl function escape($1) or another way to do this?