正则匹配输入框数字、字母

只匹配数字及字母的正则

<input  type="text"

onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')"

  />

只匹配纯数字的正则

<input  type="text"

onkeyup="this.value=this.value.replace(/[^0-9]+/g,'')"

  />

posted @ 2019-04-07 18:03  小提莫~  阅读(840)  评论(0编辑  收藏  举报