2016-02-25 125 views
-1

我emailids低於正則表達式來排除emailids有特殊字符

EmailAddress 
[email protected] 
#[email protected] 
[email protected]& 
a#b#[email protected] 
[email protected] 
[email protected] 
[email protected]+in 
[email protected] 
ab/c\@in.in 
ab\[email protected] 
[email protected] 
[email protected] 

我不得不分離含有比- _ @ . 我寫了下面的霸王龍及其工作罰款以外的其他特殊字符無效mailids樣本集。請指出我是否錯過了任何可能的情況,或者這個rex可以改進。提前致謝。

[^\$\+\\/~#!&]* 

Clean List 
[email protected] 
[email protected] 
[email protected] 

Invalid List 
#[email protected] 
[email protected]& 
a#b#[email protected] 
[email protected] 
[email protected] 
[email protected]+in 
ab/c\@in.in 
ab\[email protected] 
[email protected] 
+0

這是中間步驟之一。還有其他步驟要檢查它是否符合[email protected]格式或不完全數字等。 – Gokul

+0

請使用SO來詢問編程問題。這是一個代碼審查問題,您可以在其中詢問潛在的問題。 – bolav

回答

1

您使用本地部分中的#號碼發送地址。 我認爲在RFC 5322之後是一個有效的字符。