0
我试图用特定值替换所有字符串,即我想用imgclose替换此字符串imgclose =“”。 我想这如何用等号(=)符号替换字符串
xmlString.replace(/^imgclose=""/, "imgclose")
我试图用特定值替换所有字符串,即我想用imgclose替换此字符串imgclose =“”。 我想这如何用等号(=)符号替换字符串
xmlString.replace(/^imgclose=""/, "imgclose")
因为^
的正则表达式将只匹配,如果你想与您需要删除^
任何imgclose=""
与imgclose=""
开始,字符串。如果您想要替换任何出现的字符串,您需要添加g
修饰符。
最后的正则表达式看起来像这样:
xmlString.replace(/imgclose=""/g, "imgclose")
Thanx ...它的工作.. – user3189828
这工作吗? – RRK
也可以使用'str.substr(0,8)' – dekts