PHP preg_match check for parentheses

     

I am currently working on trying to create a calculator in PHP that will take the input of one whole string after that I have it identify which part of the string contains the math problem and then I am using eval() to solve the problem. My goal is to make a conditional that will allow for the part that has the math problem to only have numbers white space and the necessary characters for the basic math. My problem is that I can't figure out how to check for parentheses.


Here is my code:


if (preg_match("/ s*([-+]?)(d+)(?:s*([-+*/])s*((?:s[-+])?d+)s*)+$/