【发布时间】:2018-11-08 13:55:42
【问题描述】:
我正在尝试使用 Zapier 代码中的正则表达式从文本字符串中提取多个电子邮件地址。
var rawList = "This is just a test of everything@test.com not sure how regex@email.com can extract multiple email@addresses.com but we will see";
var emailList = rawList.match(/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/);
console.log(emailList)
这总是将emailList 返回为空。我从https://www.regular-expressions.info/index.html 中提取了这个正则表达式我还尝试了来自其他网站的电子邮件正则表达式,但体验仍然相同。
我还使用了 Zapier 的 Formatter 的 Extract Pattern 选项并尝试了相同的表达式,但也没有运气。不知道这里发生了什么?
【问题讨论】:
-
可能你错过了
/gi修饰符:var emailList=rawList.match(/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi);
标签: javascript regex email-validation zapier