PHP Replacing With Preg_Replace() – String Function

 
$members=<<<textname               E-Mail Address
------------------------------------------------
A      i@example.com
D      k@example.com
M      m@example.org
B      b@example.net
TEXT;print preg_replace('/[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}/',
                   '[ address removed ]', $members);

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.