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] => uk@example1.com
[1] => uk@example2.com
[2] => sales@woot.com
[3] => sales@woot.com
[4] => info@regex.com
[5] => info@regex.com
[6] => direct@yadayada.com.au
[7] => direct@yadayada.au
[8] => adrian@blahblah.com
[9] => adrian@blahblah.com
)
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.