Skip to content

Instantly share code, notes, and snippets.

@crynobone
Created January 15, 2013 09:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crynobone/4537413 to your computer and use it in GitHub Desktop.
Save crynobone/4537413 to your computer and use it in GitHub Desktop.
Simple Regular Expression to parse `NAME <email@address.com>`
<?php
$email = "Mior Muhammad Zaki <crynobone@gmail.com>";
if (preg_match('/^(.+\s)<(.*)>$/', $email, $matches))
{
$name = $matches[1];
$email = $matches[2];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment