RegExr example: http://regexr.com?333h5
正则表达式:
_email=(.+)[^s"]
示例内容:
http://example.com/index.php?package=icard&action=show_birthday_card&cid=3376&name=Gina&unsubscribe_email=myEmail1234@aol.com
[ Unsubscribe from iCard: http://example.com/index.php?package=icard&action=unsubscribe_card&unsubscribe_email=myEmail1234@aol.com ]
--1q2w3e4r5t6y7u8i9o0p1q
Content-Type: text/html;
<table align=""center"">
<tr>
<td>
<div style=""background:#fff; border:10px solid #2d50d6; padding:10px; width:600px;"">
<h4 style=""background:#2d50d6; color:#fff; border:18px solid #2d50d6; margin-bottom:10px; font-family:Arial, Helvetica, sans-serif; font-size:14px; text-align:center;"">Happy Birthday Gina!</h4>
<a href=""http://example.com/index.php?package=icard&action=show_birthday_card&cid=3376&name=Gina&unsubscribe_email=myEmail1234@aol.com""><img src=""http://example.com/images/brands/chiro/cards/img_46a6924710bcc_birthdayparty.gif"" alt="""" title=""Happy+Birthday+Gina%21"" width=""600"" style=""border:0; margin-bottom:10px; width:600px; height:150px;"" /></a>
<p style=""color:#000; font-family:Arial, Helvetica, sans-serif; font-size:12px;"">We hope all your birthday dreams and wishes come true!</p>
_email=(.+)[^s"]
表示"_email=",后跟任何类型的 1 多字符,后跟一个既不是空格也不是引号的字符。
我认为您正在寻找的是:
_email=[^s"]+
这是"_email="后跟 1 个既不是空格也不是引号的字符。
这不仅仅是选择电子邮件地址,因为+
是一个贪婪的运算符,并且会尝试匹配尽可能多的字符。
电子邮件地址匹配是一个相当常见的正则表达式问题,因此有许多解决方案,其中一个包含在有关如何使用正则表达式的优秀教程中。 我建议使用这些经过良好测试的模式之一......
_email=(b[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}b)