diff --git a/README.md b/README.md index 28eea05..a52e839 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ -# 正则大全 -图形界面: https://any86.github.io/any-rule/ +# 正则大全 ![](https://img.shields.io/badge/已收录-44条-4caf50.svg) ![](https://img.shields.io/badge/license-MIT-F44336.svg) +:whale:图形界面: https://any86.github.io/any-rule/ + ## html注释 ```javascript @@ -103,7 +104,7 @@ ## email地址 ```javascript -/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/ +/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/ ``` ## 国内座机电话,如: 0341-86091234 diff --git a/scripts/md.js b/scripts/md.js index 36b17eb..3780f22 100644 --- a/scripts/md.js +++ b/scripts/md.js @@ -1,8 +1,10 @@ const fs = require('fs'); const chalk = require('chalk'); const json = require('../src/RULES.js'); -let content = `# 正则大全 -图形界面: https://any86.github.io/any-rule/\r\n`; +let content = `# 正则大全 ![](https://img.shields.io/badge/已收录-${json.length}条-4caf50.svg) ![](https://img.shields.io/badge/license-MIT-F44336.svg) +:whale:图形界面: https://any86.github.io/any-rule/\r\n +`; + json.forEach(({title, rule})=>{ content+= `\r\n## ${title}\r\n`; content+= `\`\`\`javascript\r\n`; diff --git a/src/RULES.js b/src/RULES.js index 6838650..01a72af 100644 --- a/src/RULES.js +++ b/src/RULES.js @@ -102,7 +102,7 @@ module.exports = [ }, { title: 'email地址', - rule: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/, + rule: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, example: '如: 90203918@qq.com、nbilly@126.com' }, {