對於電子郵件,我總是用這個表達式
("([a-zA-Z0-9._%+-]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)")
其他電子郵件,而不是使用正則表達式使用字符串搜索
if line.tolower.contains("dot") and line.tolower.contains("com")
or if line.tolower.contains("@") and "com"
or if line.tolower.contains("@") and "net"
or if line.tolower.contains("mail") and "com"
or if line.tolower.contains("gmail") or "Yahoo" or "hotmail" or "bing"
正如你所看到的,你將不得不作出相當很少規則
對於電話號碼
("(?:\b\d{10,11}\b)")
("[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]")
然後像電子郵件,你將不得不使用。載
只有這樣,才能確保你覆蓋每一個號碼在那裏 - 你將需要添加信函方式每個區號在一系列類似:
"twosixfive"
"fourninesix"
還有:
"two six five"
"four nine six"
還有:
"two-six-five"
"four-nine-six"
這裏是所有地區代碼的列表:http://en.wikipedia.org/wiki/List_of_NANP_area_codes
有沒有那麼多,你只需要願意花時間做到這一點。
因此,當您阻止顯示聯繫人信息的「常見」形式後,用戶將會發現「不常見」的形式......要解決這個問題,您需要AI或HI(H = human,在它發佈之前)。 – CBroe
總之,你不能。 –
你可以關閉,不聽上述評論,你只需要願意制定所有的規則。我在下面發佈了其中的一些。 – Nefariis