细绳:(STR,0:30) + |“户外”| + |“椅垫”、“商用地垫”、“门垫”| + [帖子类型] + (STR,0:30)结果:(STR,0:30) +“户外”+ |“椅垫”、“商业地垫”、“门垫”| + [帖子类型] + (STR,0:30)我努力了preg_replace('/\|\"[a-z A-Z]\"\|/i', '"', $string);我无法找到任何解决方案,我知道的唯一条件是字符串将以|"和 结尾"|,如果它不包含","之间,我们可以删除或替换|"和"|"
1 回答
叮当猫咪
TA贡献1776条经验 获得超12个赞
我认为你可以使用这样的正则表达式:
\|("[^,]+")\|
$re = '/\|("[^,]+")\|/m';
$str = '(STR,0:30) + |"Outdoor"| + |"Chair Mat","Commercial Floor Mat","Door Mat"| + [Post Type] + (STR,0:30)';
$subst = '$1';
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
// (STR,0:30) + "Outdoor" + |"Chair Mat","Commercial Floor Mat","Door Mat"| + [Post Type] + (STR,0:30)
分享
- 1 回答
- 0 关注
- 114 浏览
添加回答
举报
0/150
提交
取消