PHP regular expression

i have to find whether input string contains sin(x),cos(x) and + sign
if any of these(sin(x),cos(x),+) is not found the result should be invalid string.

can preg_match() function be used or any other function can be used.
if preg_match() can be used what will be the pattern.

hi, your regex will look something like:

if (!preg_match('/cos\\(x\\)|sin\\(x\\)|\\+/',$string))
   echo "Error: 'cos(x)', 'sin(x)' or '+' not found";

A nice tool to play with PHP regex functions can be found at

Thank you.

Its working.