I have the following string that would require me to parse it via Regex in C#.
Format: rec_mnd.rate.current_rate.sum.QWD.RET : 214345
I would like to extract our the bold chars as group objects in a groupcollection.
QWD = 1 group
RET = 1 group
214345 = 1 group
what would the message pattern be like?
It would be something like this:
The question mark in the first two groups make that quantifier lazy: it will capture the least possible amount of characters. In other words, it captures until the first
.it sees. Alternatively, you could use([^.]+)in those groups, which explicitly captures everything except a period.The last group explicitly only captures decimal digits. If your expression can have other values on the right side of the
:you’d have to change that to.+as well.