How to count preg_match matches in smarty? Why is the following not working?
{preg_match("/\[PGN.*](.*)\[\/PGN.*\]/", $code, $match)}
{$match|@count}
As far as I understand your needs, the following does work, just make the regex not greedy:
preg_match_all("~\[PGN\d+](.+?)\[/PGN\d+]~", $code, $match)