I just started to learn about Regular Expression with Java. I have this project from hyperskill.com called "Smart Calculator" it is like the Python interpreter where you can input a arithmetic operation and when you press enter there is an output.
I would like to match if the input is valid like 2 + 2 - 3 and won't match if the input is 2 + 2 - .
I have these regular expression (\s*[0-9]+\s*[\+\-\*\/]+\s*[0-9]+\s*){1,}
But when I tried to test with some inputs...
[In] 1 + 1
[Out] Matched
[In] 1 + 1 + 1 // Not matched
[Out] Not Matched
[In] 1 + 12 + 1 //But this one matched
[Out] Matched