正則表達(dá)式匹配中文字 正則表達(dá)式,允許輸入漢字?
正則表達(dá)式,允許輸入漢字?functionChinasimple(str){varstrs=結(jié)構(gòu)更換(/(^s)|(s$)/g,”)//刪除if(!標(biāo)準(zhǔn)匹配(/^[(1-龥](méi){2,4}$/){//我習(xí)
正則表達(dá)式,允許輸入漢字?
functionChinasimple(str){varstrs=結(jié)構(gòu)更換(/(^s)|(s$)/g,”)//刪除if(!標(biāo)準(zhǔn)匹配(/^[(1-龥](méi){2,4}$/){//我習(xí)慣使用matchalert(“只能輸入2到4個(gè)漢字”)返回值}
函數(shù)chinasimple(STR){var STRs=結(jié)構(gòu)更換(/(^s)|(s$)/g,”)//刪除(!標(biāo)準(zhǔn)匹配(/^[(1-龥](méi){2,4}$/){//我習(xí)慣于使用match alert(“only 2 to 4 Chinese characters”)return false}}