美文网首页
常用正则

常用正则

作者: 瓩千瓦 | 来源:发表于2019-08-02 17:35 被阅读0次

输入数字

/^(0|[1-9]\d*)\b/g

输入0~100数字

 /^(?:[1-9]?\d|100)$/
/^(?:[1-9]?[0-9]|100)$/

去除首尾空格


 /(^\s*)|(\s*$)/g
onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g, '')"

去除标签正则


var re=/<[^>]+>/g;
str=str.replace(re,"");

相关文章

网友评论

      本文标题:常用正则

      本文链接:https://www.haomeiwen.com/subject/xwcrdctx.html