随笔分类 -  正则

摘要:一 案例 数字:^[0-9]*$ n位的数字:^\d{n}$ 至少n位的数字:^\d{n,}$ m-n位的数字:^\d{m,n}$ 零和非零开头的数字:^(0|[1-9][0-9]*)$ 非零开头的最多带两位小数的数字:^([1-9][0-9]*)+(.[0-9]{1,2})?$ 带1-2位小数的正 阅读全文
posted @ 2019-03-18 15:27 深海懒猫
摘要:script标签替换 html = html.replace(/<script.*?\/lang\/.*?></ig, matchStr => { let result = matchStr.replace(/\.js.*?\"/ig, `.js?stamp=${stamp}"`); return 阅读全文
posted @ 2019-01-02 21:52 深海懒猫