2014-06-10 28 views
1

下面是我使用正則表達式:正則表達式 - 如何讓我的表情不區分大小寫?

.*?\@(?!yahoo|gmail|hotmail).* 

基本上我試圖讓所有非雅虎/的Gmail/Hotmail的電子郵件地址。上述工作,但是如果有人輸入「[email protected]」,那麼它將不匹配。

我試過尋找答案,但沒有任何工作。這可能嗎?

我想在HTML5輸入模式屬性使用此:

<input type="email" pattern=".*?\@(?!yahoo|gmail|hotmail).*" title="Email Address (no yahoo, gmail or hotmail)" id="emailaddress" name="emailaddress" required="">

+1

可能重複[從HTML5的一個輸入的pattern屬性忽略案例](http://stackoverflow.com/questions/5524842/have-html5s-a-inputs-pattern-attribute-ignore-case) –

+0

@AndrewArnold我不這麼認爲,我沒有使用模式.. 。 –

+1

你當然在使用一種模式。 – Palpatim

回答

0

.*?\@(?![yY][aA][hH][oO][oO]|[gG][mM][aA][iI][lL]|[hH][oO][tT][mM][aA][iI][lL]).*

承蒙@ hjpotter92