Waht would be an idiomatic way to split strings that may contain any combination of digits and letters into groups of digits and letters but keeping the order).
ex:
X45C -> X-45-C
5K -> 5-K
How would be an elegant way to implement that?
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.
Regex to the rescue!
If
\Dis the right choice depends on the actual input, consult the pattern docs for further information.