gpt4 book ai didi

javascript - 正则表达式 - 使用正则表达式提取电子邮件文档的子字符串

转载 作者:行者123 更新时间:2023-11-29 17:46:38 25 4
gpt4 key购买 nike

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

online regex tester

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

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

Google Apps Script code

Logger

有谁知道为什么不起作用?

最佳答案

使用文字正则表达式而不是将字符串转换为正则表达式是可行的。

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

enter image description here

关于javascript - 正则表达式 - 使用正则表达式提取电子邮件文档的子字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48869896/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com