3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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);
Output for 4.3.0 - 7.1.0
Array ( [0] => Array ( ) [1] => Array ( ) [2] => Array ( ) ) Array ( [0] => Array ( [0] => {user:fname} [1] => {user:lname} ) [1] => Array ( [0] => user [1] => user ) [2] => Array ( [0] => fname [1] => lname ) )