In PHP, I have a string like this:
$string = \"user@domain.com MIME-Version: bla bla bla\";
How do i get the email address only? Is there a
Email addresses are really tricky to filter using regular expressions because there are so many possible allowable characters. It can be done, but you may have to tweak it some to get exactly what you need.
You could start with something like this:
$string = "user@domain.com MIME-Version: bla bla bla";
$matches = array();
$pattern = '/[A-Za-z0-9_-]+@[A-Za-z0-9_-]+\.([A-Za-z0-9_-][A-Za-z0-9_]+)/'
preg_match($pattern,$string,$matches);
And then $matches should contain your email address.