Assuming the expression is this: /\{[a-z]+\:[a-zA-Z\_]+ ("(.*?)" ?){1,}/ We are using preg_match_all() And assuming the string was: {func:date "l" "z" "i"} This is the array of matches: Array ( [0] => Array ( [0] => {func:date "l" "z" "i" ) [1] => Array ( [0] => "i" ) [2] => Array ( [0] => i ) )