I have one or more telephone numbers in a string. They are separated with spaces. How can i capture those numbers into groups, without spaces? And I dont want to use split.
Share
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.
So, basically you’re looking something to split anything by spaces. This is the regex I’d use:
Probably, using this would be a better choice:
Because this would include any whitespace characters (space, tab, NL, FF, VT, CR).
However, I agree with the rest of the commenters that going for a split() is your best choice…
Here is the regex example.