首页 文章

正则表达式 - 谷歌应用程序脚本

提问于
浏览
0

我正在尝试使用正则表达式提取电子邮件文档的子字符串 . 我在线测试正则表达式,它完美地运行:

online regex tester

我有一个功能来检查Google Apps脚本上的正则表达式,同样的正则表达式在这里不起作用 .

var regex = new RegExp("Intrusion signature\(s\)\:\n\n(.*)");
var e = regex.exec(data);

Google Apps Script code

Logger

有谁知道为什么不工作?

1 回答

  • 1

    使用文字正则表达式而不是将字符串转换为正则表达式 .

    var regex = new RegExp(/Intrusion signature\(s\)\:\n\n(.*)/);
    

    enter image description here

相关问题