I have a string like
"which I want (which I don't want)"
"which I want"
(which I do not want)
$val = "which I want (which I don't want)";
reg_replace('/((.*))/', '', $val);
You almost had it. Since the parenthesis are special characters in regular expressions, you have to escape them in order for it to work:
preg_replace('/(\s?\(.*\))/', '', $val);
) are group delimiters in RegEx, whereas
\) are literal parenthesis.
I also added an optional whitespace before the parenthesis so you get rid of that too.