我在 PHP 中有这个字符串
$content="<a some_text> {pr_start} some_text</a> <a other_text>{pr_stop}</a>
<a some_text> {pr_start} </a> <a some_text> {pr_start} </a>";
我想替换所有出现的子字符串
"<a some_text> {pr_start} some_text</a>"
带文字"START"
,其余部分保持原样!
预期的结果是:
"START <a other_text>{pr_stop}</a> START START"
我用了
preg_replace('#<a(.*)({pr_start})(.*)</a>#',"START",$content);
任何想法?谢谢!