3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = '[This] 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:
48.2 ms | 402 KiB | 5 Q