收藏 幾個常用的用正規表示式驗證字串的函式

2021-09-08 05:53:11 字數 390 閱讀 7491

應用也很簡單,以上函式均是應用在伺服器端,若用在客戶端需要把runat=server去掉。我舉兩個例子:

if isipaddress.test(str)=false then

response.write"ip 位址錯誤,請重新輸入。"

response.end

end if

if testpwd(str)=false then

response.write"密碼錯誤,請重新輸入。"

response.end

end if

事實上你只要熟練掌握正規表示式的應用,對於判斷字串輸入的正確性那簡直是小菜一碟。正規表示式還能用於字串替換,ubb語法就是用正規表示式的替換做成的。

收藏常用正規表示式

d 非負整數 正整數 0 0 9 1 9 0 9 正整數 d 0 非正整數 負整數 0 0 9 1 9 0 9 負整數 d 整數 d d 非負浮點數 正浮點數 0 0 9 0 9 1 9 0 9 0 9 1 9 0 9 0 9 0 9 1 9 0 9 正浮點數 d d 0 0 非正浮點數 負浮點數 ...

收藏 幾個常用的用正規表示式驗證字串的函式

應用也很簡單,以上函式均是應用在伺服器端,若用在客戶端需要把runat server去掉。我舉兩個例子 if isipaddress.test str false then response.write ip 位址錯誤,請重新輸入。response.end end if if testpwd str...

收藏 幾個常用的用正規表示式驗證字串的函式

應用也很簡單,以上函式均是應用在伺服器端,若用在客戶端需要把runat server去掉。我舉兩個例子 if isipaddress.test str false then response.write ip 位址錯誤,請重新輸入。response.end end if if testpwd str...