---
title: "正则速查表整理元字符量词与零宽断言语法，附常用匹配示例更随手查阅 - AllTools - 全能工具箱"
description: "AllTools 的正则速查表按类归纳元字符、量词、分组、零宽断言与 Unicode 属性，并附邮箱、URL、日期等常用匹配示例，编码或排查正则时随手查阅，省去反复搜索语法文档的时间，提升编写效率。"
canonical_url: "https://tool.warmday.wang/dev/regex-cheatsheet"
meta:
  author: AllTools
  keywords: "在线工具箱, AllTools, 实用工具, 生活常用, 数学计算, 文本处理, 图片处理, 开发者工具, PDF 工具, 单位换算, 免费工具, 免登录工具"
  "og:description": "AllTools 的正则速查表按类归纳元字符、量词、分组、零宽断言与 Unicode 属性，并附邮箱、URL、日期等常用匹配示例，编码或排查正则时随手查阅，省去反复搜索语法文档的时间，提升编写效率。"
  "og:image": "https://tool.warmday.wang/img/og-cover.png"
  "og:image:alt": "AllTools - 全能工具箱 Logo"
  "og:image:height": "630"
  "og:image:width": "1200"
  "og:title": 正则速查表整理元字符量词与零宽断言语法，附常用匹配示例更随手查阅
  "twitter:image": "https://tool.warmday.wang/img/og-cover.png"
---

> Index of every page on this site: [llms.txt](https://tool.warmday.wang/llms.txt)

# **正则速查表**

正则表达式语法速查手册，快速查找常用模式。

**搜索**

### **字符匹配**

`.`pages.dev.regex-items.char-match.anychar

`\d`pages.dev.regex-items.char-match.digit

`\D`pages.dev.regex-items.char-match.nondigit

`\w`pages.dev.regex-items.char-match.wordchar

`\W`pages.dev.regex-items.char-match.nonwordchar

`\s`pages.dev.regex-items.char-match.whitespace

`\S`pages.dev.regex-items.char-match.nonwhitespace

`\b`pages.dev.regex-items.char-match.wordboundary

`\B`pages.dev.regex-items.char-match.nonwordboundary

`[abc]`pages.dev.regex-items.char-match.charset-in

`[^abc]`pages.dev.regex-items.char-match.charset-notin

`[a-z]`pages.dev.regex-items.char-match.range

`[a-zA-Z]`pages.dev.regex-items.char-match.alpha-range

`[0-9]`pages.dev.regex-items.char-match.digit-range

`\`pages.dev.regex-items.char-match.escape

### **量词**

`*`pages.dev.regex-items.quantifiers.star

`+`pages.dev.regex-items.quantifiers.plus

`?`pages.dev.regex-items.quantifiers.optional

`{n}`pages.dev.regex-items.quantifiers.exact-n

`{n,}`pages.dev.regex-items.quantifiers.atleast-n

`{n,m}`pages.dev.regex-items.quantifiers.range-nm

`*?`pages.dev.regex-items.quantifiers.lazy-star

`+?`pages.dev.regex-items.quantifiers.lazy-plus

`??`pages.dev.regex-items.quantifiers.lazy-optional

`{n,m}?`pages.dev.regex-items.quantifiers.lazy-range

### **分组与引用**

`(abc)`pages.dev.regex-items.grouping.capture

`(?:abc)`pages.dev.regex-items.grouping.non-capture

`(?<name>abc)`pages.dev.regex-items.grouping.named-capture

`\1`pages.dev.regex-items.grouping.backref-num

`\k<name>`pages.dev.regex-items.grouping.backref-name

`(?=abc)`pages.dev.regex-items.grouping.lookahead

`(?!abc)`pages.dev.regex-items.grouping.neg-lookahead

`(?<=abc)`pages.dev.regex-items.grouping.lookbehind

`(?<!abc)`pages.dev.regex-items.grouping.neg-lookbehind

### **锚点与边界**

`^`pages.dev.regex-items.anchors.start

`$`pages.dev.regex-items.anchors.end

`\b`pages.dev.regex-items.anchors.wordboundary

`\B`pages.dev.regex-items.anchors.nonwordboundary

### **修饰符**

`g`pages.dev.regex-items.modifiers.global

`i`pages.dev.regex-items.modifiers.insensitive

`m`pages.dev.regex-items.modifiers.multiline

`s`pages.dev.regex-items.modifiers.dotall

`u`pages.dev.regex-items.modifiers.unicode

`y`pages.dev.regex-items.modifiers.sticky

### **特殊构造**

`|`pages.dev.regex-items.special.alternation

`(a|b)`pages.dev.regex-items.special.alt-group

`[\u4e00-\u9fa5]`pages.dev.regex-items.special.chinese-range

`[\u4e00-\u9fa5a-zA-Z0-9]`pages.dev.regex-items.special.chinese-alnum

`\x{hh}`pages.dev.regex-items.special.hex-char

`\u{hhhh}`pages.dev.regex-items.special.unicode-char

`\0`pages.dev.regex-items.special.null-char

`\n`pages.dev.regex-items.special.newline

`\r`pages.dev.regex-items.special.carriage-return

`\t`pages.dev.regex-items.special.tab

### **常用正则表达式**

**邮箱**`^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$`

**手机号**`^1[3-9]\d{9}$`

**身份证号**`^\d{17}[\dXx]$`

**URL**`^https?://[\w\-]+(\.[\w\-]+)+[/#?]?.*$`

**IP 地址**`^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$`

**日期**`^\d{4}[-/](0[1-9]|1[0-2])[-/](0[1-9]|[12]\d|3[01])$`

**时间**`^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$`

**中文字符**`^[\u4e00-\u9fa5]+$`

**邮政编码**`^[1-9]\d{5}$`

**十六进制颜色**`^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$`

**强密码**`^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$`

**车牌号**`^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤川青藏琼宁][A-Z][A-Z0-9]{5,6}$`

### **使用说明**

#### **功能介绍**

正则速查表汇集了常用的正则表达式语法，包括字符匹配、量词、分组与引用、锚点与边界、修饰符、特殊构造等六大类，并提供邮箱、手机号、身份证号、URL 等常见场景的完整正则模板，方便快速查阅与复制。

#### **操作步骤**

在顶部搜索框输入关键词（如"数字"、"边界"、"邮箱"）即可模糊匹配相关语法；浏览各分类下的语法条目，左侧为语法符号、右侧为说明；在"常用正则表达式"卡片中，鼠标悬停到目标行上点击复制图标即可复制完整正则到剪贴板。

#### **分类说明**

字符匹配（.、\\d、\\w 等）用于匹配单字符；量词（\*、+、{n,m}）控制匹配次数；分组与引用（()、(?:)）用于提取与回溯；锚点与边界（^、$、\\b）限定匹配位置；修饰符（g、i、m）改变整体匹配行为；特殊构造（

#### **注意事项**

不同语言对正则的转义规则略有差异，复制到代码中时需注意是否需要双重转义（如 JavaScript 字符串中 \\d 需写成 \\d）；常用模板仅作基础校验，生产环境建议结合业务规则调整；正则性能在复杂回溯场景下可能下降，应避免过度嵌套与贪婪量词滥用。

## **同类工具**

同一个分类下还有这些 · 开发工具

[**Cron 表达式**可视化生成 Cron 定时任务表达式，点选分、时、日、月、周字段并实时预览未来多次执行时间，适配定时调度。告别手写五段式语法易错难题，稳定配置后台任务。](https://tool.warmday.wang/dev/cron) [**JSON 格式化**JSON 数据美化、压缩与语法校验，自动定位括号缺失与逗号错误，支持折叠展开，辅助接口排查配置整理。适配前后端联调与配置文件整理，快速排查返回数据结构。](https://tool.warmday.wang/dev/json) [**时间戳转换**Unix 时间戳与本地日期双向转换，支持秒级与毫秒级精度，自动同步当前时间戳，方便排查日志时间线、缓存过期与接口时间字段问题。](https://tool.warmday.wang/dev/timestamp) [**正则测试**在线测试正则表达式，输入文本实时高亮匹配结果，可视化展示分组捕获与替换效果，支持 g/i/m 等标志位切换，方便编写与调试复杂正则。](https://tool.warmday.wang/dev/regex) [**JWT 解析**将 JWT 按 base64url 拆解为 Header、Payload 与 Signature 三段，解码并展示声明字段与过期时间，无需密钥即可查看 Token 载荷内容，方便排查接口鉴权。](https://tool.warmday.wang/dev/jwt-parser) [**JWT 生成**在线签发 JSON Web Token，可自定义 Header 算法、Payload 声明与过期时间，支持 HS256、RS256、ES256 等签名方式，方便联调鉴权流程生成测试 Token。](https://tool.warmday.wang/dev/jwt-generator)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://tool.warmday.wang/#organization","name":"AllTools","alternateName":"AllTools - 全能工具箱","url":"https://tool.warmday.wang/","logo":{"@type":"ImageObject","url":"https://tool.warmday.wang/img/logo.png","width":512,"height":512}},{"@type":"WebSite","@id":"https://tool.warmday.wang/#website","url":"https://tool.warmday.wang/","name":"AllTools - 全能工具箱","inLanguage":"zh","publisher":{"@id":"https://tool.warmday.wang/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://tool.warmday.wang/?q={search_term_string}"},"query-input":"required name=search_term_string"}},{"@type":"WebPage","@id":"https://tool.warmday.wang/dev/regex-cheatsheet#webpage","url":"https://tool.warmday.wang/dev/regex-cheatsheet","isPartOf":{"@id":"https://tool.warmday.wang/#website"},"inLanguage":"zh","name":"正则速查表整理元字符量词与零宽断言语法，附常用匹配示例更随手查阅","description":"AllTools 的正则速查表按类归纳元字符、量词、分组、零宽断言与 Unicode 属性，并附邮箱、URL、日期等常用匹配示例，编码或排查正则时随手查阅，省去反复搜索语法文档的时间，提升编写效率。"},{"@type":"SoftwareApplication","@id":"https://tool.warmday.wang/dev/regex-cheatsheet#app","name":"正则速查表整理元字符量词与零宽断言语法，附常用匹配示例更随手查阅","description":"AllTools 的正则速查表按类归纳元字符、量词、分组、零宽断言与 Unicode 属性，并附邮箱、URL、日期等常用匹配示例，编码或排查正则时随手查阅，省去反复搜索语法文档的时间，提升编写效率。","url":"https://tool.warmday.wang/dev/regex-cheatsheet","applicationCategory":"DeveloperApplication","operatingSystem":"Web","inLanguage":"zh","isPartOf":{"@id":"https://tool.warmday.wang/dev/regex-cheatsheet#webpage"},"offers":{"@type":"Offer","price":"0","priceCurrency":"CNY"}},{"@type":"BreadcrumbList","@id":"https://tool.warmday.wang/dev/regex-cheatsheet#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"首页","item":"https://tool.warmday.wang/"},{"@type":"ListItem","position":2,"name":"开发工具","item":"https://tool.warmday.wang/dev"},{"@type":"ListItem","position":3,"name":"正则速查表","item":"https://tool.warmday.wang/dev/regex-cheatsheet"}]}]}
```

## Sitemap

See the full [sitemap](https://tool.warmday.wang/sitemap.md) for all pages.
