3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $pattern = "hello[/name/hello[/second]][/bye]"; if (preg_match_all('/\[((?:[^\[\]]*|(?R))*)\]/', $pattern, $matches)) { print_r($matches); }
Output for 4.3.0 - 7.2.6
Array ( [0] => Array ( [0] => [/name/hello[/second]] [1] => [/bye] ) [1] => Array ( [0] => /name/hello[/second] [1] => /bye ) )