---
title: "Regex Cheatsheet Syntax Reference - AllTools"
description: "AllTools organizes regex metacharacters, quantifiers, groups, lookarounds and Unicode with examples."
canonical_url: "https://tool.warmday.wang/en/dev/regex-cheatsheet"
meta:
  author: AllTools
  keywords: "online tools, AllTools, free online tools, developer tools, image tools, PDF tools, text tools, unit converter, no login, browser-based tools"
  "og:description": "AllTools organizes regex metacharacters, quantifiers, groups, lookarounds and Unicode with examples."
  "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": "Regex Cheatsheet Syntax Reference"
  "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)

# **Regex Cheatsheet**

Regular expression syntax reference for quick lookup of common patterns.

**Search**

### **Character Matching**

`.`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

### **Quantifiers**

`*`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

### **Grouping & Backreferences**

`(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

### **Anchors & Boundaries**

`^`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

### **Modifiers**

`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

### **Special Constructs**

`|`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

### **Common Regular Expressions**

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

**Phone Number**`^1[3-9]\d{9}$`

**ID Card Number**`^\d{17}[\dXx]$`

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

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

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

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

**Chinese Characters**`^[\u4e00-\u9fa5]+$`

**ZIP Code**`^[1-9]\d{5}$`

**Hex Color**`^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$`

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

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

### **Usage Guide**

#### **Features**

The regex cheatsheet collects common regex syntax across six categories: character matching, quantifiers, grouping & references, anchors & boundaries, modifiers, and special constructs. It also provides complete regex templates for common scenarios like email, phone numbers, ID card numbers, and URLs for quick reference and copying.

#### **Steps**

Enter keywords (such as "number", "boundary", "email") in the top search bar to fuzzy-match related syntax. Browse syntax entries under each category: the syntax symbol is on the left, description on the right. In the "Common Regular Expressions" card, hover over a target row and click the copy icon to copy the full regex to clipboard.

#### **Category Guide**

Character matching (., \\d, \\w, etc.) matches single characters; quantifiers (\*, +, {n,m}) control match count; grouping & references ((), (?:)) enable extraction and backtracking; anchors & boundaries (^, $, \\b) limit match positions; modifiers (g, i, m) change overall matching behavior; special constructs (

#### **Notes**

Different languages have slightly different regex escaping rules. When copying to code, note whether double escaping is needed (e.g., \\d must be written as \\d in JavaScript strings). Common templates are for basic validation only; it is recommended to adjust based on business rules in production environments. Regex performance may degrade in complex backtracking scenarios; avoid excessive nesting and greedy quantifier abuse.

## **Related tools**

More from the same category · Developer Tools

[**Cron Expression**Visual Cron builder: pick minute-hour-day-month-weekday fields and preview next run times live.](https://tool.warmday.wang/en/dev/cron) [**JSON Formatter**JSON beautify, minify and validate with auto error location for missing brackets and stray commas.](https://tool.warmday.wang/en/dev/json) [**Timestamp Converter**Convert Unix timestamps to dates and back with second/millisecond precision and live current time.](https://tool.warmday.wang/en/dev/timestamp) [**Regex Tester**Test regex with live match highlighting, capture groups and substitution, toggling g/i/m/s flags.](https://tool.warmday.wang/en/dev/regex) [**JWT Parser**Split a JWT into header, payload and signature, then base64url-decode claims and expiry without a key.](https://tool.warmday.wang/en/dev/jwt-parser) [**JWT Generator**Issue JWTs with custom header, claims and expiry across HS256, RS256, ES256 for auth-flow testing.](https://tool.warmday.wang/en/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/en#website","url":"https://tool.warmday.wang/en","name":"AllTools","inLanguage":"en","publisher":{"@id":"https://tool.warmday.wang/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://tool.warmday.wang/en?q={search_term_string}"},"query-input":"required name=search_term_string"}},{"@type":"WebPage","@id":"https://tool.warmday.wang/en/dev/regex-cheatsheet#webpage","url":"https://tool.warmday.wang/en/dev/regex-cheatsheet","isPartOf":{"@id":"https://tool.warmday.wang/en#website"},"inLanguage":"en","name":"Regex Cheatsheet Syntax Reference","description":"AllTools organizes regex metacharacters, quantifiers, groups, lookarounds and Unicode with examples."},{"@type":"SoftwareApplication","@id":"https://tool.warmday.wang/en/dev/regex-cheatsheet#app","name":"Regex Cheatsheet Syntax Reference","description":"AllTools organizes regex metacharacters, quantifiers, groups, lookarounds and Unicode with examples.","url":"https://tool.warmday.wang/en/dev/regex-cheatsheet","applicationCategory":"DeveloperApplication","operatingSystem":"Web","inLanguage":"en","isPartOf":{"@id":"https://tool.warmday.wang/en/dev/regex-cheatsheet#webpage"},"offers":{"@type":"Offer","price":"0","priceCurrency":"CNY"}},{"@type":"BreadcrumbList","@id":"https://tool.warmday.wang/en/dev/regex-cheatsheet#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://tool.warmday.wang/en"},{"@type":"ListItem","position":2,"name":"Developer Tools","item":"https://tool.warmday.wang/en/dev"},{"@type":"ListItem","position":3,"name":"Regex Cheatsheet","item":"https://tool.warmday.wang/en/dev/regex-cheatsheet"}]}]}
```

## Sitemap

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