In .NET, I'm trying to parse strings like these into groups of numbers. The "a" and "b" are optional (but fixed) letters:
111a222b333 --> groups: num1=111, num2=222, num3=333
111 --> groups: num1=111
111b333 --> groups: num1=111, num3=333
b333 --> groups: num3=333
The regular expressions I've tried include:
(?<num1>\d+)?a?(?<num2>\d+)?b?(?<num3>\d+)?
(?<num1>\d+)*.*(a(?<num2>\d+))*.*(b(?<num3>\d+))*
But they are not working. Any suggestions?