欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js實(shí)現(xiàn)正則匹配中文標(biāo)點(diǎn)符號(hào)的方法

 更新時(shí)間:2015年12月23日 14:16:38   作者:views  
這篇文章主要介紹了js實(shí)現(xiàn)正則匹配中文標(biāo)點(diǎn)符號(hào)的方法,涉及JavaScript正則匹配與判定的簡(jiǎn)單使用技巧,需要的朋友可以參考下

本文實(shí)例講述了js正則匹配中文標(biāo)點(diǎn)符號(hào)的方法。分享給大家供大家參考,具體如下:

運(yùn)行效果截圖如下:

具體代碼如下:

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>js正則匹配中文標(biāo)點(diǎn)符號(hào)</title>
<head>
<body>
<input type="text" id="textBox" maxlength="1" /> 
<input type="button" onclick="checkText()" value="提交" />
<script type="text/javascript">
function checkText()
{
 var text = document.getElementById('textBox').value;
 //匹配這些中文標(biāo)點(diǎn)符號(hào) 。 ? ! , 、 ; : “ ” ‘ ' ( ) 《 》 〈 〉 【 】 『 』 「 」 ﹃ ﹄ 〔 〕 … — ~ ﹏ ¥
 var reg = /[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/;
 if(reg.test(text)){
  alert('是中文標(biāo)點(diǎn)符號(hào)');
 }else{
  alert('不是中文標(biāo)點(diǎn)符號(hào)');
 }
}
</script>
</body>
</html>

PS:這里再為大家提供2款非常方便的正則表達(dá)式工具供大家參考使用:

JavaScript正則表達(dá)式在線測(cè)試工具:
http://tools.jb51.net/regex/javascript

正則表達(dá)式在線生成工具:
http://tools.jb51.net/regex/create_reg

希望本文所述對(duì)大家JavaScript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論