I need some help with php regex, I want to "split" email address "[email protected]" to "johndoe" and "@example.com"
Until now I have this: preg_match('/<?([^<]+?)@/', '[email protected]', $matches);
And I get Array ( [0] => johndoe@ [1] => johndoe)
So how I need to change regex?
$parts = explode('@', "[email protected]");
$user = $parts[0];
// Stick the @ back onto the domain since it was chopped off.
$domain = "@" . $parts[1];