正则表达式参考目录正则表达式参考目录正则表达式参考目录正则表达式参考目录
  • 文章
  • 正则表达式
    • 工具
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容
发表 admin at 2024年3月5日
类别
  • 正则表达式
标签
正则表达式参考目录
  • 简
  • 繁
  • En
关于正则表达式 » 正则表达式参考

Regex 参考
简介
目录
快速参考
字符
基本功能
字符类别
速记
锚点
字词边界
量词
Unicode
捕获组和反向引用
命名组和反向引用
特殊组
模式修改器
递归和平衡组
替换参考
字符
配对文本和反向引用
内容和大小写转换
条件式
更多内容
简介
正则表达式快速入门
正则表达式教程
替换字符串教程
应用程序和语言
正则表达式范例
正则表达式参考
替换字符串参考

正则表达式参考目录

简介

简介说明如何阅读正则表达式参考表格。

快速参考

如果您在别人的 regex 中看到一些语法,但不知道该语法是什么功能,请使用这个快速参考。如果您知道想要什么功能,但忘记语法,请使用下面列出的完整参考表格。

字面字符、特殊字符和不可打印字符

大多数字元都与自己配对。有些字符有特殊含义,必须转义。使用控制字符转义或十六进位转义,可以更轻松地输入不可打印字符。

基本功能

大多数正则表达式风格支持的基本正则表达式功能。

字符类别和字符类别操作符

字符类别或字符集会配对几个可能字符中的单一字符,包含个别字符和/或字符范围。否定字符类别会配对字符类别中不存在的单一字符。字符类别减法和交集让您可以配对一个存在于一个字符集中的字符,且不存在/也存在于另一个字符集中。

速记字符类别

速记字符类别让您可以快速使用常见的字符集。您可以单独使用速记或将其作为字符类别的一部分。

锚点

锚点长度为零。它们不配对任何字符,而是配对位置。有锚点可以配对主旨字符串的开头和结尾,以及锚点可以配对每一行的开头和结尾。

字词边界

字词边界就像锚点,但会在字词开头和/或结尾进行比对。

使用各种量词进行重复

量词允许您重复项目特定次数或无限次数。

Unicode 字符和属性

如果您的正则表达式风格支持 Unicode,则可以使用特殊的 Unicode 正则表达式符号来比对特定的 Unicode 字符,或比对具有特定 Unicode 属性或属于特定 Unicode 范畴或区段的任何字符。

捕获组和反向引用

通过在正则表达式的一部分周围加上括号,您可以指示引擎在套用量词或将选项群组在一起时,将该部分视为单一项目。括号也会创建捕获组,让您可以重复使用由正则表达式的一部分比对到的文本。反向引用会比对先前由该捕获组比对到的相同文本,让您可以比对重复文本的模式。

命名组和反向引用

如果使用命名捕获组和命名反向引用,则具有多个群组的正则表达式会更容易阅读和维护。

特殊组

特殊组,例如分支重设群组、原子组、环顾和条件式。

模式修改器

变更比对模式,例如正则表达式特定部分的「不区分大小写」。

递归、子常式调用和平衡组

子常式调用允许您撰写正则表达式,以便在多个地方比对相同的建构,而无需重复正则表达式的一部分。递归和平衡组允许您比对任意嵌套的建构。

正規表示式參考目錄
  • 简
  • 繁
  • En
關於正規表示式 » 正規表示式參考

Regex 參考
簡介
目錄
快速參考
字元
基本功能
字元類別
速記
錨點
字詞邊界
量詞
Unicode
擷取群組和反向參照
命名群組和反向參照
特殊群組
模式修改器
遞迴和平衡群組
替換參考
字元
配對文字和反向參照
內容和大小寫轉換
條件式
本網站的更多資訊
簡介
正規表示式快速入門
正規表示式教學
替換字串教學
應用程式和語言
正規表示式範例
正規表示式參考
替換字串參考

正規表示式參考目錄

簡介

簡介說明如何閱讀正規表示式參考表格。

快速參考

如果您在別人的 regex 中看到一些語法,但不知道該語法是什麼功能,請使用這個快速參考。如果您知道想要什麼功能,但忘記語法,請使用下面列出的完整參考表格。

字面字元、特殊字元和不可列印字元

大多數字元都與自己配對。有些字元有特殊含義,必須跳脫。使用控制字元跳脫或十六進位跳脫,可以更輕鬆地輸入不可列印字元。

基本功能

大多數正規表示式風格支援的基本正規表示式功能。

字元類別和字元類別運算子

字元類別或字元集會配對幾個可能字元中的單一字元,包含個別字元和/或字元範圍。否定字元類別會配對字元類別中不存在的單一字元。字元類別減法和交集讓您可以配對一個存在於一個字元集中的字元,且不存在/也存在於另一個字元集中。

速記字元類別

速記字元類別讓您可以快速使用常見的字元集。您可以單獨使用速記或將其作為字元類別的一部分。

錨點

錨點長度為零。它們不配對任何字元,而是配對位置。有錨點可以配對主旨字串的開頭和結尾,以及錨點可以配對每一行的開頭和結尾。

字詞邊界

字詞邊界就像錨點,但會在字詞開頭和/或結尾進行比對。

使用各種量詞進行重複

量詞允許您重複項目特定次數或無限次數。

Unicode 字元和屬性

如果您的正規表示式風格支援 Unicode,則可以使用特殊的 Unicode 正規表示式符號來比對特定的 Unicode 字元,或比對具有特定 Unicode 屬性或屬於特定 Unicode 範疇或區段的任何字元。

擷取群組和反向參照

透過在正規表示式的一部分周圍加上括號,您可以指示引擎在套用量詞或將選項群組在一起時,將該部分視為單一項目。括號也會建立擷取群組,讓您可以重複使用由正規表示式的一部分比對到的文字。反向參照會比對先前由該擷取群組比對到的相同文字,讓您可以比對重複文字的模式。

命名群組和反向參照

如果使用命名擷取群組和命名反向參照,則具有多個群組的正規表示式會更容易閱讀和維護。

特殊群組

特殊群組,例如分支重設群組、原子群組、環顧和條件式。

模式修改器

變更比對模式,例如正規表示式特定部分的「不區分大小寫」。

遞迴、子常式呼叫和平衡群組

子常式呼叫允許您撰寫正規表示式,以便在多個地方比對相同的建構,而無需重複正規表示式的一部分。遞迴和平衡群組允許您比對任意巢狀的建構。

Regular Expressions Reference Table of Contents
  • 简
  • 繁
  • En
About Regular Expressions » Regular Expressions Reference

Regex Reference
Introduction
Table of Contents
Quick Reference
Characters
Basic Features
Character Classes
Shorthands
Anchors
Word Boundaries
Quantifiers
Unicode
Capturing Groups & Backreferences
Named Groups & Backreferences
Special Groups
Mode Modifiers
Recursion & Balancing Groups
Replacement Reference
Characters
Matched Text & Backreferences
Context & Case Conversion
Conditionals
More on This Site
Introduction
Regular Expressions Quick Start
Regular Expressions Tutorial
Replacement Strings Tutorial
Applications and Languages
Regular Expressions Examples
Regular Expressions Reference
Replacement Strings Reference

Regular Expressions Reference Table of Contents

Introduction

The introduction explains how to read the regular expressions reference tables.

Quick Reference

Use this quick reference if you’ve seen some syntax in somebody else’s regex and you have no idea what feature that syntax is for. Use the full reference tables listed below if you know what feature you want but don’t remember the syntax.

Literal Characters, Special Characters, and Non-Printable Characters

Most characters match themselves. Some characters have special meanings and must be escaped. Non-printable characters are easier to enter using control character escapes or hexadecimal escapes.

Basic Features

Basic regular expression features supported by most regular expression flavors.

Character Classes and Character Class Operators

A character class or character set matches a single character out of several possible characters, consisting of individual characters and/or ranges of characters. A negated character class matches a single character not in the character class. Character class subtraction and intersection allow you to match one character that is present in one set of characters and not/also present in another set of characters.

Shorthand Character Classes

Shorthand character classes allow you to use common sets of characters quickly. You can use shorthands on their own or as part of character classes.

Anchors

Anchors are zero-length. They do not match any characters, but rather a position. There are anchors to match at the start and end of the subject string, and anchors to match at the start and end of each line.

Word Boundaries

Word boundaries are like anchors, but match at the start of a word and/or the end of a word.

Repetition Using Various Quantifiers

Quantifiers allow you to repeat an item a specific or an unlimited number of times.

Unicode Characters and Properties

If your regular expression flavor supports Unicode, then you can use special Unicode regex tokens to match specific Unicode characters, or to match any character that has a certain Unicode property or is part of a particular Unicode script or block.

Capturing Groups and Backreferences

By placing parentheses around part of the regex, you tell the engine to treat that part as a single item when applying quantifiers or to group alternatives together. Parentheses also create capturing groups allow you to reuse the text matched by part of the regex. Backreferences to capturing groups match the same text that was previously matched by that capturing group, allowing you to match patterns of repeated text.

Named Groups and Backreferences

Regular expressions that have multiple groups are much easier to read and maintain if you use named capturing groups and named backreferences.

Special Groups

Special groups such as branch reset groups, atomic groups, lookaround, and conditionals.

Mode Modifiers

Change matching modes such as “case insensitive” for specific parts of the regular expression.

Recursion, Subroutine Calls, and Balancing Groups

Subroutine calls allow you to write regular expressions that match the same constructs in multiple places without having to duplicate parts of your regular expression. Recursion and balancing groups allow you to match arbitrarily nested constructs.

©2015-2025 艾丽卡 support@alaica.com