fork download
  1. <?php
  2.  
  3. $re = '/[\p{L}0-9_.-]+@[0-9\p{L}.-]+\.[a-z.]{2,6}\b/u';
  4. $str = 'Please email us at: some@example.com. You can also mail us at some@example.co.uk. Etc... hello@åä-ö.com
  5. example@so.il.uk';
  6. if (preg_match_all($re, $str, $matches)) {
  7. print_r($matches[0]);
  8. }
Success #stdin #stdout 0s 82624KB
stdin
Standard input is empty
stdout
Array
(
    [0] => some@example.com
    [1] => some@example.co.uk
    [2] => hello@åä-ö.com
    [3] => example@so.il.uk
)