Quote Originally Posted by cstryx View Post
In my opinion, regex is not the best solution anyways and it's also going to be slower than regular string manipulation.
IMO...

This si a good time to use a regex.
The input is from a 'trusted' source (not user input), is short and relatively constant.

A regex will produce clear and maintainable code.

A regex can be a configuation item, allowing easy change without a rebuild.


BTW if performance is an issue, 'for' is faster than 'foreach' and implicit comparisions (>='0' and <= '9') are faster than string functions (IsDigit)