Extract email and name with regex

(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))

https://regex101.com/r/pVV5TI/1


use this regex "?([^"]*)"?\s*([^\s]+@.+)

group 1 contains name

group 2 contains email


The following regex appears to work on all inputs and uses only two capturing groups:

(?:"?([^"]*)"?\s)?(?:<?(.+@[^>]+)>?)

http://regex101.com/r/dR8hL3

Thanks to @RohitJain and @burning_LEGION for introducing the idea of non-capturing groups and character exclusion respectively.