(ACCTG) Accounting
The text above I trying to get the information in the parentheses how would I do that in php this is what I have so far.
$regex = '#\((([^()]+|(?R))*)\)#';
if (preg_match_all($regex, $string ,$matches)) {
echo implode(' ', $matches[1]);
} else {
//no parenthesis
echo $string;
}
I do converting special characters to hex for easy use in my regex's
<?
$input = 'abc ("an example")';
if(preg_match("/\x28([^\x29]+)\x29/", $input, $matched)) {
//...
print_r($matched);
} else {
//do something..
}
?>
Wouldn't this be sufficient:
\(([^\)]*)\).*