如果我做正则表达式匹配
preg_match('/^[*]{2}((?:[^*]|[*][^*]*[*])+?)[*]{2}(?![*]{2})/s', "**A** **B**", $matches);
我得到了我想要的$matches
的结果
Array ( [0] => **A** [1] => A )
但我不知道如何修改正则表达式以在输入文本中产生$matches
中相同的结果而没有中间的空格,即"**A****B**"
。
它看起来像正则表达式匹配
preg_match('/^[*]{2}((?:[^*]|[*][^*]*[*])+?)[*]{2}/s', "**A****B**", $matches);
得到我想要的$matches
的结果
Array ( [0] => **A** [1] => A )