Say I have a string such as
abc123def456
What’s the best way to split the string into an array such as
["abc", "123", "def", "456"]
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.
The boundary you look for can be described as “A position where a digit follows a non-digit, or where a non-digit follows a digit.”
So:
Use
[0-9]and[^0-9], respectively, if\dand\Dare not specific enough.