天天看點

判斷郵箱的正規表達式

郵箱@字首的幾種類型:

1、純數字         [email protected] 

2、純字母      [email protected]

3、字母數字混合   [email protected]

4、帶點的      [email protected]

5、帶下劃線     [email protected]

6、帶連接配接線     [email protected]

郵箱@字尾的類型:

1、[email protected]

2、[email protected]

*至少有兩處單詞

*頂級域名一般為2~4位(如cn、com、club)

預設字首、字尾不以\'_\'、\'-\'、\'.\'結尾,是以正則可以寫成:

1 ^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$       

\d:表示[0-9]

判斷郵箱的正規表達式