3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subject = "text text text text [hello] text (hello2) (hello3) text"; $pattern = '/^\[([^)]*)\]/'; preg_match($pattern, $subject, $matches); print_r($matches);

preferences:
33.89 ms | 402 KiB | 5 Q