0

RegExrの例: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>
4

2 に答える 2

3
_email=(.+)[^\s"]

「_email=」の後に1-任意のタイプの多くの文字が続き、その後に空白でも引用符でもない単一の文字が続くことを意味します。

私はあなたが探しているものは次のとおりだと思います:

_email=[^\s"]+

これは「_email=」の後に1-空白でも引用符でもない多くの文字が続きます。

于 2012-12-10T20:14:07.837 に答える
1

は貪欲な演算子であるため、これは電子メールアドレスだけではなく、+できるだけ多くの文字を一致させようとします。

電子メールアドレスの照合は、かなり一般的な正規表現の問題です。そのため、正規表現の使用方法に関する優れたチュートリアルに1つが含まれているため、多くの解決策があります。これらのよくテストされたパターンの1つをそのまま使用することをお勧めします...

_email=(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b)

于 2012-12-10T20:17:19.850 に答える