3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = '[This is] is a [test] string, [eat] my [shorts].'; preg_match_all("/\[[^\]]*\]/", $text, $matches); var_dump($matches[0]); $text = '[This] is a [test] string, [eat] my [shorts].'; preg_match_all("/\[([^\]]*)\]/", $text, $matches); var_dump($matches[1]);

preferences:
52.69 ms | 402 KiB | 5 Q