Extract email and name with regex

后端 未结 5 2082
醉酒成梦
醉酒成梦 2020-12-06 02:10

What would be the regular expressions to extract the name and email from strings like these?

johndoe@example.com
John 
John Doe &l         


        
5条回答
  •  萌比男神i
    2020-12-06 02:19

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

    group 1 contains name

    group 2 contains email

提交回复
热议问题