【发布时间】:2016-04-29 17:50:39
【问题描述】:
我有以下字符串:
'this is a "text field" need "to replace"'
我想在每个非双引号单词和双引号之前添加加号(+)字符,如下所示:
'+this +is +"text field" +need +"to replace"'
有没有办法执行这样的操作?我尝试了str_replace 和正则表达式,但不知道该怎么做。
【问题讨论】:
-
与我们分享您的尝试以及失败的原因。
-
并告知字符串是否可以包含转义引号。
标签: php regex preg-replace preg-match str-replace