Posted By

muddy on 08/27/18


Tagged

regex php


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

muddy


Find email in text


 / Published in: PHP
 

URL: https://adultvids.de/

Thanks to adultvids.de

  1. <?php
  2. $string = 'John < [email protected] >';
  3. $pattern = '/[a-z0-9_\-\+\.][email protected][a-z0-9\-]+\.([a-z]{2,4})(?:\.[a-z]{2})?/i';
  4. preg_match_all($pattern, $string, $matches);
  5. var_dump($matches[0]);
  6. ?>

Report this snippet  

You need to login to post a comment.