This should be an easy one, but I’m tired and not thinking straight at the time.
I have the following string:
"Brian Hannah <brian@abktechnologies.com>"
I want to extract the name and email address into separate variables using PHP.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just for completeness, here’s an approach using regular expressions:
See it working online: ideone
Since the
*is greedy in the first match, a string likeA<B <c.d>will be parsed as"A<B", "<c.d>", and not"A", "<B <c.d>". To change this write(.*?)instead.