PHP/REGEX: Get a string within parentheses
try:
preg_match('/\((.*?)\)/', $s, $a);
output:
Array
(
[0] => (hollow highlight)
[1] => hollow highlight
)
You just need to add capturing parenthesis, in addition to your escaped parenthesis.
<?php
$in = "hello (world), my name (is andrew) and my number is (845) 235-0184";
preg_match_all('/\(([A-Za-z0-9 ]+?)\)/', $in, $out);
print_r($out[1]);
?>
This outputs:
Array ( [0] => world [1] => is andrew [2] => 845 )