Regex to parse Email Form “To” field

googlehacker

New Member
If there is one that could handle this, what would be the correct regex pattern to extract email addresses from a string coming from an email form "To" line, that allows the addresses to be delimited by commas ",", semicolons ";", spaces, or any combination of the three. The regex also has to be able to ignore "noise" text, such as if an address is enclosed in "<" and ">" characters, or has an actual name next to the email address. For example, from this string that was in the To field:\[code\]"Joe Smith" <[email protected]>, [email protected]; [email protected] [email protected]\[/code\]The pattern should be able to return the following matches of:jsmith@example, [email protected], [email protected], [email protected] am using PHP, so if this can't be done in single regex then im definitely open to other PHP-based solutions.Thanks
 
Back
Top