Skip to content

Instantly share code, notes, and snippets.

@crynobone
Created January 15, 2013 09:13
Show Gist options
  • Select an option

  • Save crynobone/4537413 to your computer and use it in GitHub Desktop.

Select an option

Save crynobone/4537413 to your computer and use it in GitHub Desktop.
Simple Regular Expression to parse `NAME <[email protected]>`
<?php
$email = "Mior Muhammad Zaki <[email protected]>";
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