$string ='"Test User" <test@test.com>,"Another" <another@test.com>,"aeer" <whateveryourmail@gmail.com>';
Run Code Online (Sandbox Code Playgroud)
我已经成功将这个名称和电子邮件地址拆分为此代码
preg_match_all('!"(.*?)"\s+<\s*(.*?)\s*>!', $string, $matches);
Run Code Online (Sandbox Code Playgroud)
问题是,我无法验证电子邮件地址,虚假的电子邮件地址也会匹配.如何过滤有效的电子邮件,还要拆分姓名和电子邮件地址?