【发布时间】:2021-07-22 15:20:16
【问题描述】:
输入:
$str = 'hi test1="12c4 ab3d" blablabla test1="5678 sdfg"'
所以我需要在 5 个字符后删除 'test1="' 和 '"' 之间的字符串,如下所示:
'hi test1="12c4" blablabla test1="5678"'
我已经试过了:
$str= preg_replace('/test1="[\s\S]+?"/', 'test1=""', $str);
但我的输出是:
'hi test1="" blablabla test1=""'
【问题讨论】:
标签: php string replace preg-replace