1. 程式人生 > >校驗正則表達式案例

校驗正則表達式案例

func cti tex .get a-z inpu input doc lur

<input id="a" type="text" onblur="test123();" />

function test123()
        {
            var regx = /^[\u4E00-\u9FA5A-Za-z0-9]+$/
            var value = document.getElementById("a").value
            if(regx.test(value))
            {
                alert(value)
            } else {
                alert("格式錯誤");
            }   
        }       

校驗正則表達式案例