所以在我的代码中
body.replaceText(" TEST1"" TEST2&#34);
有效,简单的正则表达式,但我无法让更复杂的正则表达式工作。例如,我想删除两个标签之间的所有间距,并用三个回车替换它。我已经在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>");
答案 0 :(得分:1)
我试过这个,它对我有用
body.replaceText("</em>\\[\\\\r\\\\n\\]\\+<strong>", '</em>\r\r\r<strong>');