Reputation: 3163
My preg_match_all
function:
preg_match_all("{lang:(.*?)}", $template, $found_langs);
The template is like:
<h1>{lang:Choose sport}</h1>
But it won't find it... BUT if I use this:
preg_match_all("{lang:(\w*)}", $template, $found_langs);
It'll find Choose
. I need to find Choose sport
..
Anyone knows why (.*?)
won't work?
Upvotes: 1
Views: 99
Reputation: 12306
Try to escape {
char and use //
for RegEx pattern in preg_match_all:
preg_match_all("/\{lang:(.*?)\}/i", $template, $found_langs);
And //i
at the end of pattern is a case insensitivity.
Upvotes: 7