我该如何使用这个正则表达式? (Aweber Email Parser)

时间:2009-09-01 23:12:17

标签: regex parsing

我在解决如何使用正则表达式时遇到一些困难,Aweber为电子邮件解析提供了

我应该能够通过此规则集向aweber发送电子邮件,并且aweber会将电子邮件添加到我的列表中。

以下是规则:

Trigger Rule:    From:[^\n|.]+user\@domain\.com | MATCH HEADERS
Rule 1:          \n[>\s]*Email:\s+(.+?)\n       | MATCH BODY
Rule 2:          \n[>\s]*Name:\s+(.+?)\n        | MATCH BODY

有谁知道这是如何工作的?正则表达式期望接收什么格式?

非常感谢你的帮助!

最佳, 尼克

1 个答案:

答案 0 :(得分:1)

假设您对上述评论的回答并未实质性地改变意图:

Trigger Rule:    From:[^\n|.]+user\@domain\.com | MATCH HEADERS
# Match "From:" and "user@domain.com" all on the same line

Rule 1:          \n[>\s]*Email:\s+(.+?)\n       | MATCH BODY
#Match "<<beginning of line>> <<some white space, or maybe not>> "Email:" <<some white space, but maybe more>> <<anything and everything until the end of the line>>

Rule 2:          \n[>\s]*Name:\s+(.+?)\n        | MATCH BODY
#Match "<<beginning of line>> <<some white space, or maybe not>> "Name:" <<some white space, but maybe more>> <<anything and everything until the end of the line>>

编辑:

标记为"<<some white space, or maybe not>>"的行应为"<<some white space, or several ">" characters, or maybe none of these>>