我有一個文本框字段,我想規範什麼輸入英寸空白空間正則表達式asp.net
我不希望用戶輸入更多或更少,然後6-10個字符。這裏是我的限制字符的正則表達式^。{6,10} $我有這部分工作,但我也不希望用戶輸入空格(空格)。現在,我可以檢測輸入開始處和輸入結束處的空白,但是如果用戶在文本中間鍵入空格,則不能。看例子。
" testing" = regulator detects the space in the beginning. regex i use ^[^\s].+[^\s]$
"testing " = regulator detects the space in the end. regex i use here is same as abow
"test ing" = regulator does not detect the space in the middle. tried different regex with no luck.
我該如何創建一個能夠完成我所需要的調節器?
謝謝,^ [^ \ s] {6,10} $ working像一個魅力 – Mana