3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string = 'a{ra:calc(*(la)100%);font-s'; $string_regex = '((?<!\\\\)(?:\\\\\\\\)*(\'|")(?:.*?[^\\\\])??(?:\\\\\\\\)*\\2)'; $comment_regex = '(\\/\\*(?:(?!\\*\\/).)*\\*\\/)'; $url_regex = '(?<=:| |,|\\(|\\))(url)\\s*(\\()\\s*((?:[^()]+|(?2))*?)\\s*(\\))'; $calc_regex = '(?<=:| |,|\\(|\\))(calc)\\s*(\\()\\s*((?:[^()]+|(?2))*?)\\s*(\\))'; $string = preg_match('/'.$calc_regex.'/si', $string, $matches); var_dump($matches);
Output for 4.3.0 - 7.1.0
array(5) { [0]=> string(10) "calc(*(la)" [1]=> string(4) "calc" [2]=> string(1) "(" [3]=> string(4) "*(la" [4]=> string(1) ")" }