I have a string I want to split: D017209D019169D019014 into D017209, D019169, and D019014 with commas in between.
If I have
a = D017209D019169D019014
b = a.slice("D")
puts b
My result looks like:
017209
019169
019014
What am I missing?
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.
Scan returns an array of all the matches, which is exactly what you want here. The regex simply means D, followed by zero or more non-D’s.