The (
and )
will need to be escaped. .
is any character and *
is zero or more occurrences of the previous character/grop; +
is one or more. So put that together with delimiters and you have:
<?php
echo preg_replace('/\(.*?\)/', '', 'happy (adj)
sad (v)');
Note the ?
as well that takes away the greediness of the *
quantifier, http://www.regular-expressions.info/possessive.html.
Regex Demo: https://regex101.com/r/zQ5bW1/2
PHP Demo: https://eval.in/595919
or you could use a negated character class to find the closing )
.
echo preg_replace('/\([^)]+\)/', '', 'happy (adj)
sad (v)');
Alternative regex demo: https://regex101.com/r/zQ5bW1/3