While developing chrome extension for detecting the mobile numbers, I have used javascript included in to the content script. For implementation I used this link for detection but using this javascript are also detecting from html attributes like
<a href="1234567890.pdf"> file 1 </a>
Since, 1234566780 is not a mobile numbers it get detected as a number. How can these html tags can be ignored while performing this replacing task. Is there any javascript function to ignore the HTML tags ?
I think this can be done by implementing the regex of
1. ignoring the characters start with "<" and end with ">"
here is html file,
<html>
<head>
<title>test</title>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript">
</script>
<script>
$(document).ready(function () {
$('body').each(function () {
$(this).html($(this).html().replace(/(\d\d\d\d\d\d\d\d\d\d)/g, '<a href="#">$1</a>'));
});
});
</script>
</head>
<body>Vignesh - 9427415949 <a href="1234567890.pdf"> file 1 </a>
</body>
</html>