I have a string
“JonSmith02-11-1955”
I use
preg_split to get JonSmith (reg='[0-9-]’) then do it again (‘[a-zA-Z]\ ‘) to get his birthdate.
Is there any better way to get them both in one split ?
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.
works in this case. It matches a position preceded by a letter and followed by a digit. Read about lookbehinds and -aheads for more information.
This won’t work if the name can contain digits.
DEMO