in reply to Alternating Integers and Commas in Regex
Your approach can also depend in-part on how confident you are that the entire file always conforms to the same predictable format, e.g. that a line always contains ten split-groups, that there are always exactly two groups-of-interest, that they are always #9 and #10, that the comma groups always end with a trailing comma. If you can, indeed, be confident that the data coming in to the program is always good and clean, then go straight for the simple, as previously described.
On the other hand, I like to write programs like this so they’re a bit skeptical. They check the number of split-groups: there should be exactly ten. They apply a regex pattern to groups #9 and #10 which verify that the data does consist of alternating groups of commas and one-or-more digits, with a trailing comma. And they die if anything is out of the ordinary, such that the program is not only retrieving wanted data out of the file, but sniffing it for funny smells. If the program runs to completion, this becomes reason to believe that the file did not contain “garbage in,” thus probably no “garbage out.” Unless you take the time to look, you don’t know, and so a little bit of “I’m from Missouri” can really help in debugging the system of which this one program is a part.