A bit of an odd question – I’m hoping to avoid some really ugly programming and thought that someone may have a nifty way of doing this…
I’m currently working on a regex that matches to numbers in a string, say “222”. Sometimes these numbers include decimals, “222.5” or sometimes in place of a ‘.5’ it is replaced with a plus sign – ie. 222+.
Any thoughts on how I could write either a Regex, or a general C# line, that could interpret that ‘+’ symbol after any number as a .5? Here is an example of the current code I have (does not do anything with ‘+’ symbols).
string match = Regex.Match(subject, @"\s*-?\d+").Value;
1 Answer