Reputation: 89
How to remove ? I have html file with 300 000 lines I want to remove all contens, all tags, everything, but keep emails. example in the file:
ght="20"valign="top"bgcolor="#FFFFFF"><spanclass="style43style44">+995</strong>
<a href="mailto:[email protected]">[email protected]</a>
:fefw.gefew?chat">rewews</a>
in this file is 1000 email address.
Upvotes: 0
Views: 108
Reputation: 7791
Try with this example:
<?php
$content = 'ght="20"valign="top"bgcolor="#FFFFFF"><spanclass="style43style44">+995</strong>
<a href="mailto:[email protected]">[email protected]</a>
<a href="mailto:[email protected]">[email protected]</a>
[email protected]
:fefw.gefew?chat">rewews</a>';
$matches = array(); //create array
$pattern = "/[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})/i";
preg_match_all($pattern, $content, $matches);
print_r(array_values(array_unique($matches[0])));
?>
Upvotes: 1