---
title: "正規表達式速查表 - 免費線上工具 - AllTools - 全能工具箱"
description: "整理正規表達式的中繼字元、量詞、分組、零寬斷言與 Unicode 屬性，附常用符合模式範例，方便撰寫與閱讀複雜正規表達式時隨手查閱。AllTools 提供免費線上工具，開啟網頁即可使用，無需安裝或登入，資料在瀏覽器本機處理。"
canonical_url: "https://tool.warmday.wang/zh-Hant/dev/regex-cheatsheet"
meta:
  author: AllTools
  keywords: "線上工具箱, AllTools, 實用工具, 生活常用, 數學計算, 文字處理, 圖片處理, 開發者工具, PDF 工具, 單位換算, 免費工具, 免登入工具"
  "og:description": "整理正規表達式的中繼字元、量詞、分組、零寬斷言與 Unicode 屬性，附常用符合模式範例，方便撰寫與閱讀複雜正規表達式時隨手查閱。AllTools 提供免費線上工具，開啟網頁即可使用，無需安裝或登入，資料在瀏覽器本機處理。"
  "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/zh-Hant/dev/cron) [**JSON 格式化**JSON 資料美化、壓縮與語法校驗，自動定位括號缺失與逗號錯誤，支援摺疊展開，輔助 API 排查設定整理。適配前後端聯合除錯與設定檔整理，快速排查回應資料結構。](https://tool.warmday.wang/zh-Hant/dev/json) [**時間戳記轉換**Unix 時間戳記與本機日期雙向轉換，支援秒級與毫秒級精度，自動同步目前時間戳記，方便排查日誌時間軸、快取到期與 API 時間欄位問題。](https://tool.warmday.wang/zh-Hant/dev/timestamp) [**正規表達式測試**線上測試正規表達式，輸入文字即時標示符合結果，視覺化展示分組擷取與取代效果，支援 g/i/m 等旗標切換，方便撰寫與除錯複雜正規表達式。](https://tool.warmday.wang/zh-Hant/dev/regex) [**JWT 解析**將 JWT 依 base64url 拆解為 Header、Payload 與 Signature 三段，解碼並展示宣告欄位與到期時間，無需金鑰即可檢視 Token 載荷內容，方便排查 API 驗證授權。](https://tool.warmday.wang/zh-Hant/dev/jwt-parser) [**JWT 產生**線上簽發 JSON Web Token，可自訂 Header 演算法、Payload 宣告與到期時間，支援 HS256、RS256、ES256 等簽章方式，方便聯合除錯驗證授權流程產生測試 Token。](https://tool.warmday.wang/zh-Hant/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/zh-Hant#website","url":"https://tool.warmday.wang/zh-Hant","name":"AllTools - 全能工具箱","inLanguage":"zh-Hant","publisher":{"@id":"https://tool.warmday.wang/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://tool.warmday.wang/zh-Hant?q={search_term_string}"},"query-input":"required name=search_term_string"}},{"@type":"WebPage","@id":"https://tool.warmday.wang/zh-Hant/dev/regex-cheatsheet#webpage","url":"https://tool.warmday.wang/zh-Hant/dev/regex-cheatsheet","isPartOf":{"@id":"https://tool.warmday.wang/zh-Hant#website"},"inLanguage":"zh-Hant","name":"正規表達式速查表 - 免費線上工具","description":"整理正規表達式的中繼字元、量詞、分組、零寬斷言與 Unicode 屬性，附常用符合模式範例，方便撰寫與閱讀複雜正規表達式時隨手查閱。AllTools 提供免費線上工具，開啟網頁即可使用，無需安裝或登入，資料在瀏覽器本機處理。"},{"@type":"SoftwareApplication","@id":"https://tool.warmday.wang/zh-Hant/dev/regex-cheatsheet#app","name":"正規表達式速查表 - 免費線上工具","description":"整理正規表達式的中繼字元、量詞、分組、零寬斷言與 Unicode 屬性，附常用符合模式範例，方便撰寫與閱讀複雜正規表達式時隨手查閱。AllTools 提供免費線上工具，開啟網頁即可使用，無需安裝或登入，資料在瀏覽器本機處理。","url":"https://tool.warmday.wang/zh-Hant/dev/regex-cheatsheet","applicationCategory":"DeveloperApplication","operatingSystem":"Web","inLanguage":"zh-Hant","isPartOf":{"@id":"https://tool.warmday.wang/zh-Hant/dev/regex-cheatsheet#webpage"},"offers":{"@type":"Offer","price":"0","priceCurrency":"CNY"}},{"@type":"BreadcrumbList","@id":"https://tool.warmday.wang/zh-Hant/dev/regex-cheatsheet#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"首頁","item":"https://tool.warmday.wang/zh-Hant"},{"@type":"ListItem","position":2,"name":"開發工具","item":"https://tool.warmday.wang/zh-Hant/dev"},{"@type":"ListItem","position":3,"name":"正規表達式速查表","item":"https://tool.warmday.wang/zh-Hant/dev/regex-cheatsheet"}]}]}
```

## Sitemap

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