I would like to parse a Java boolean expression like this ('Q1.A1' are just variable names):
(Q1.A1 > 3 && Q1.A2 < 5) || (Q1.A1.Q2.A3 < 5 && Q1.A2.Q5 >= 0)
This expression will be loaded from a database and then compiled and executed in my program. "Q1.A1" etc. should be references to simple object with INT property:
so that when value of that object changes the whole expression changes.
I was looking of the best way of doing this as well as finding variables in that string, cause simple Sting.contains() is not enough (Q1.A1 is a variable but also part of another variable name).
I have been looking into This problem but I don't know how to find variables in given string.