3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $css = <<<EOF a { padding: 10px; } @media (max-width: 600px) { a { padding: 0px; } } EOF; $css1 = preg_replace('/@media [^{]*{([^{}]|{[^{}]*})*}/', '', $css); var_dump($css1); $css2 = preg_replace('/@media [^{]*{([^{}]|{.*})*}/', '', $css); var_dump($css2); $css3 = preg_replace('/@media[^{]+\{([\s\S]+?})\s*}/', '', $css); var_dump($css3);
based on sAX5H
Output for 4.3.0 - 7.2.0
string(23) "a { padding: 10px; } " string(80) "a { padding: 10px; } @media (max-width: 600px) { a { padding: 0px; } }" string(23) "a { padding: 10px; } "