3v4l.org

run code in 300+ PHP versions simultaneously
<?php //with ^ $str = " {user:fname} and the last name = {user:lname}"; preg_match_all("/^\{(\w):(\w)\}/", $str, $matches); print_r($matches); //without ^ preg_match_all("/\{(\w+):(\w+)\}/", $str, $matches2); print_r($matches2);

preferences:
51.56 ms | 402 KiB | 5 Q