I need to have some Calculator done, currently i'm dealing with the issue that I need to have only numbers (0,1,2,3,4,5,6,7,8,9) and operators (+, -, *, /, .) in my JTextField which is the user's input.
Currently my regex is like:
String REGEX = "^[0-9]+[.]?[0-9]{0,1}$";
and it's from an example that I found over the web.
How do I have also to possibility to allow these operators: +
, -
, *
, /
? (the dot is already done)
The total idea is to have it like the Windows Calculator.
I'm not that strong in this topic, please advice.
EDIT: it also needs to have round braces like (
and )