![](/img/trans.png)
[英]Regex match $ but not \$ or $$ in Google Apps Script's body.replaceText()
[英]Having issues with Google Apps Script replaceText regex
所以在我的代码中
body.replaceText( “测试1”, “TEST2”);
也可以使用简单的正则表达式,但是我无法使用更复杂的正则表达式。 例如,我想删除两个标签之间的所有间距,并用三个回车符代替。 我已经在regexr和其他工具中对其进行了测试,并且可以正常工作,但是在我的Apps脚本中却没有任何作用。
body.replaceText("/</em>[\r\n]+<strong>/g","</em>\r\r\r<strong>");
这也不起作用
body.replaceText("</em>[\r\n]+<strong>","</em>\r\r\r<strong>");
我尝试了这个,对我有用
body.replaceText("</em>\\[\\\\r\\\\n\\]\\+<strong>", '</em>\r\r\r<strong>');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.