any-rule has 250,102 recorded installs on VS Code Marketplace, ranking #1305 of 2,502 tracked listings.
Rating: 5.00 / 5 from 4 ratings
About any-rule
正则大全

🦕支持web / vscode / idea / Alfred Workflow多平台
:rocket:web版本
🍭vscode插件
安装
vscode应用商店中搜索"any-rule".
使用
方式1:
- 按F1(mac下fn+F1)打开正则列表.
- 输入关键词搜索, 比如"手机".

方式2:
右键选择"🦕正则大全".

方式3:
在代码任意位置输入"@zz".

👩🏫图解正则
<details> <summary>查看详情</summary> 每次在any-rule中选择正则后会弹出提示, 可点击"🤖图解正则".
点击后可以看到正则解析, 方便大家学习.

注意: 图解直接使用了https://regexper.com, 在此对作者表示敬意和感谢.
</details>社区版本
社区版本非本人维护, 只是其他开发者使用了any-rule整理的正则内容, 如使用出现问题可直接与其开发者联系.
:fire:关于PR
欢迎大家PR, 步骤如下:
- 正则请在packages/www/src/RULES.js中添加.
- 运行
npm run test:rules进行测试. - 运行
npm run build:md更新README.md. - 请务必提交到develop分支.
在此感谢大家对any-rule做出的贡献!
🍔正则
火车车次
/^[GCDZTSPKXLY1-9]\d{1,4}$/
手机机身码(IMEI)
/^\d{15,17}$/
必须带端口号的网址(或ip)
/^((ht|f)tps?:\/\/)?[\w-]+(\.[\w-]+)+:\d{1,5}\/?$/
网址(URL)
/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-](https://github.com/any86/any-rule/blob/master/[^!@#$%^&*?.\s]{0,63}[^!@#$%^&*&.\s])?\.)+[a-z]{2,6}\/?/
统一社会信用代码
/^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/
统一社会信用代码(宽松匹配)(15位/18位/20位数字/字母)
/^(([0-9A-Za-z]{15})|([0-9A-Za-z]{18})|([0-9A-Za-z]{20}))$/
迅雷链接
/^thunderx?:\/\/[a-zA-Z\d]+=$/
ed2k链接(宽松匹配)
/^ed2k:\/\/\|file\|.+\|\/$/
磁力链接(宽松匹配)
/^magnet:\?xt=urn:btih:[0-9a-fA-F]{40,}.*$/
子网掩码(不包含 0.0.0.0)
/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(255|254|252|248|240|224|192|128|0)$/
linux"隐藏文件"路径
/^\/(?:[^/]+\/)*\.[^/]*/
linux文件夹路径
/^\/(?:[^/]+\/)*$/
linux文件路径
/^\/(?:[^/]+\/)*[^/]+$/
window"文件夹"路径
/^[a-zA-Z]:\\(?:\w+\\?)*$/
window下"文件"路径
/^[a-zA-Z]:\\(?:\w+\\)*\w+\.\w+$/
股票代码(A股)
/^(s[hz]|S[HZ])(000[\d]{3}|002[\d]{3}|300[\d]{3}|600[\d]{3}|60[\d]{4})$/
大于等于0, 小于等于150, 支持小数位出现5, 如145.5, 用于判断考卷分数
/^150$|^(?:\d|[1-9]\d|1[0-4]\d)(?:\.5)?$/
html注释
/<!--[\s\S]*?-->/g
md5格式(32位)
/^[a-fA-F0-9]{32}$/
GUID/UUID
/^[a-f\d]{4}(?:[a-f\d]{4}-){4}[a-f\d]{12}$/i
版本号(version)格式必须为X.Y.Z
/^\d+(?:\.\d+){2}$/
视频(video)链接地址(视频格式可按需增删)
/^https?:\/\/(.+\/)+.+(\.(swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4))$/i
图片(image)链接地址(图片格式可按需增删)
/^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i
24小时制时间(HH:mm:ss)
/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/
12小时制时间(hh:mm:ss)
/^(?:1[0-2]|0?[1-9]):[0-5]\d:[0-5]\d$/
base64格式
/^\s*data:(?:[a-z]+\/[a-z0-9-+.]+(?:;[a-z-]+=[a-z0-9-]+)?)?(?:;base64)?,([a-z0-9!$&',()*+;=\-._~:@/?%\s]*?)\s*$/i
数字/货币金额(支持负数、千分位分隔符)
/^-?\d{1,3}(,\d{3})*(\.\d{1,2})?$/
银行卡号(10到30位, 覆盖对公/私账户, 参考微信支付)
/^[1-9]\d{9,29}$/
中文姓名
/^(?:[\u4e00-\u9fa5·]{2,16})$/
英文姓名
/(^[a-zA-Z][a-zA-Z\s]{0,20}[a-zA-Z]$)/
车牌号(新能源)
/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z](https://github.com/any86/any-rule/blob/master?:((\d{5}[A-HJK])|([A-HJK][A-HJ-NP-Z0-9][0-9]{4}))|[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳])$/
车牌号(非新能源)
/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]$/
车牌号(新能源+非新能源)
/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/
手机号(mobile phone)中国(严谨), 根据工信部2019年最新公布的手机号段
/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1589]))\d{8}$/
手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可
/^(?:(?:\+|00)86)?1[3-9]\d{9}$/
手机号(mobile phone)中国(最宽松), 只要是1开头即可, 如果你的手机号是用来接收短信, 优先建议选择这一条
/^(?:(?:\+|00)86)?1\d{10}$/
日期(宽松)
/^\d{1,4}(-)(1[0-2]|0?[1-9])\1(0?[1-9]|[1-2]\d|30|31)$/
```…
Description from the VS Code Marketplace listing.
- regxp
- typescript
- vscode
- 正则
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Ratings over time
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Installs on a linear scale. Placement is projected from installs, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (6)Similar VS Code Marketplace Snippets plugins
All 20 any-rule alternativesany-rule on other marketplaces
Data source
Install counts, average rating, and rating counts come from the public Visual Studio Marketplace gallery API. Installs are cumulative and exclude updates.
Listing: https://marketplace.visualstudio.com/items?itemName=russell.any-rule. First seen Oct 16, 2026; last successful collection Oct 21, 2026. See the methodology.