I am trying to validate a user built query.
What I want to allow
$xxxx$+87*(50*2)25*($total$-$absent$)$total$+$present$
etc...
Note: $THESE_ARE_NAME_OF_OPERANDS$
What I do not want
$myoperand$+65ioti88+$myoperand$7kio07 + $operand$
etc...
Till now I tried to detect the bad combinations (i.e. combination of numbers and alphabets) using
var troublePattern = new Regex(@"\b[0-9]+[a-z|A-Z]");
string TroublePattern = troublePattern.ToString();
bool _present = Regex.IsMatch(UserFedData, TroublePattern, RegexOptions.None);
However it does not fully works. By fully works I mean it gives unexpected results at some point.
How do I have to modify my regex so as to acheive my aim ?