Hi, I am trying to find a string to see if it contains an email address and then will return it.
A typical vaildator email expression is:
eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email);
However, how would you search if it is in a string, for example, return the email address in a string:
"Hi, my name is Joe, you can contact us at joe@mysite.com. I'm also on Twitter."
I am a little puzzled, I know that I can search if it exists at all with \ b, but how can I return what I found.
Thanks.
source
share