preg match all - regex multiple parentheses -
$str = "<p>(a)(3) asdf (10) asdf</p>";
trying pull second set of parentheses using php preg_match_all
very big doc i'm parsing, have this:
preg_match_all("=(?:<p[^>]*>|<p[^>]*>note|<i>|</i>)\((.*)\)=siu", $str, $matches);
pulling things fine:
<p>(a) <p>note(a) <i>(a) </i>(a)
all returning (a)
i'd search time see this: <p>(a)(3)
so need second paren , value returned (3)
and not want other paren + value (a) or (10)
how this?
preg_match_all("=(?:<p[^>]*>(:?note)?|</?i>)\((.*)\)(?:\((.*)\))?=siu", $str, $matches);
Comments
Post a Comment