I am trying to match emails from one of my own sites using a regular expression. Using preg_match_all($pattern,$site,$array)
the results I get are duplicate. So for example, using:
$pattern = '/[\w-]+@([\w-]+\.)+[\w-]+/i';
I get:
Array
(
[0] => [email protected]
[1] => [email protected]
[2] => [email protected]
[3] => [email protected]
[4] => [email protected]
[5] => [email protected]
[6] => [email protected]
[7] => [email protected]
[8] => [email protected]
[9] => [email protected]
)
So, why am I getting duplicates? Is this a problem with my regex?
The string I am searching is a URL using the file_get_contents() method. I've checked the string to make sure it wasn't pulling the page twice.