I have this line for the instance:
"2 + 2 - 2" , and in evaluating it should return int(2) ;
I am looking for a function / parser that can determine if anykind matches the mathematical content in a string. Additional examples:
"(2 + 2) / 2" "(4 / 8) * 12" "128 * 8"
You do not need to evaluate and calculate these mathematical expressions, you just need a function that determines ( True/False return values) if the operator belongs to this type of mathematics.
Is this possible with regex or something else? Thanks!
user798596
source share