正则表达式匹配以%%开头和结尾的字符串

use*_*437 3 php regex

我有一个以这种格式出现多次变量的文本:

Example text will %%include%% these %%parameters%%
Run Code Online (Sandbox Code Playgroud)

我想用这个:

preg_match('/%%[\s\S]*?%%/i',$output, $matches);

但出于某种原因,我只得到第一场比赛,任何想法?

HBv*_*Bv6 6

使用preg_match_all因为您需要多个匹配项.