php - Compilation failed: unmatched parentheses at offset -
i writing regular expression, when check following regex online, works correctly. however, return error in php. why that?
preg_match_all('/^[([a-z]+\[[a-z| |,]+\])\,?]+$/', $methods, $result); return
severity: warning message: preg_match_all() [function.preg-match-all]: compilation failed: unmatched parentheses @ offset 23 i tried 1 too:
preg_match_all('/^[([a-z]+\\[[a-z| |,]+\\])\\,?]+$/', $methods, $result);
if change outer character class ([]) character group (parentheses) compile, im not sure kind of string trying match:
/^(([a-z]+\[[a-z| |,]+\])\,?)+$/ like in example
i think caused because cant put nested character class because lose meaning regex ends in 3 parts this:
[([a-z]+ \[[a-z| |,]+ \])\,?]+ ending in unmatched enter parentheses
Comments
Post a Comment