24 game/CSharp: Difference between revisions

m
corrected token regex - lookbehind was missing \/ and * operators
m (removed some duplication caused by copy/paste, edited intro text, homogenized open bracket placement)
m (corrected token regex - lookbehind was missing \/ and * operators)
Line 47:
//splits expression into it elements - i.e. "4+-30-4.123" yields {"4", "+", "-30" ,"-", "4.123"}
private const string tokenPattern = @"(?:(?<=[+/*\-+]|^)[+-]?)?(?:[0-9]+(?:\.[0-9]*)?)|[/*\-+]";
 
Regex brackets;
Anonymous user