我已經使用這個正則表達式。 這個腳本不應該允許這樣做:________ @ domain.com如何驗證我的電子郵件ID字段?
請幫我解決這個問題。
"email": {
// HTML5 compatible email regex (http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html# e-mail-state-%28type=email%29)
"regex": /^(([^<>()[\]\\.*+,;:\[email protected]\"]+(\.[^<>()[\]\\.,;:\[email protected]\"]+)*)|(\".+\"))@[^-]((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
"alertText": "* Ex: [email protected]"
},
找到這個解決方案花了5秒鐘。 https://stackoverflow.com/questions/46155/validate-email-address-in-javascript 評論指出:「這正則表達式消除了有效的,在用的電子郵件。不要使用谷歌的」RFC822「或「RFC2822」得到一個正確的正則表達式「 – Softy 2014-09-26 09:07:44
謝謝你softy ,,給我有效的正則表達式 – Samaskhan 2014-09-26 09:11:51
我需要至少1個字符或數字之前@符號。如何更改以上正則表達式? – Samaskhan 2014-09-26 09:14:24