CROSS-POST: Posted in cprogramming2 also.

Hi,

I'm writing some C++ objects (I'm basically a c programmer)and want to
find out the best way to do some parsing.

The input consists of a string with three parts
[1,4-7][1A,2A-3B][3,7-9]

I need to retrieve each of these three parts and store all the
possible values in a vector for each.[ the main problem is
combinatorics and this question is part of its implementation.]

For example, vector A would consist of 1,4,5,6,7
Vector B would consist of 1A,2A,2B,3A,3B ( since end range has 'B' the
increments are stopped with B, if it is 3C it would include
1A,2A,2B,2C,3A...)
Vector C would consist of 3,7,8,9

I can do this by parsing them char by char (or strchr/strtok).

I'm thinking this is a common enough problem and must have been
already more efficiently solved(than i can ever write)

Is there anything in standard library that i can use?

I have not used regex before but think it will only provide me the
pattern matching and not expand the ranges.

Can somebody please help with code snippets or point me to open source?

Thanks,
Reuben.

Reply via email to