
----- Original Message -----
From: "Ramon F Herrera"
I have been able to parse stuff more complicated than this, but now I am stuck with something seemingly simpler.
The expression being parsed is the common sequence:
1,2-5,7,8-11
Question 1: Notice my approach. I first match the whole expression, with "regex_match", to make sure that it is valid (that works great). Next, I use "regex_iterator" to break down the parts. Is that good practice? Am I being inefficient/redundant?
It depends :-) If it's fast enough it's good enough, and I've often done similar things (it's easy to understand compared to a more "sophisticated" approach too).
Question 2: My code below only extracts "range terms" ("x-y"), for some reason I cannot extract "number terms".
You need something like: \\d+(?:\\s*-\\s*\\d+)? to match a "digit or range". HTH, John.