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

加载更多搜索结果...

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

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

正则表达式快速参考

此快速参考是 完整参考表格 中列出的所有正则表达式语法的摘要,不含任何说明。如果您在别人的正则表达式中看到一些语法,但不知道该语法是哪个功能,可以使用此表格。请按链接进一步了解教学中的语法。由于完整参考表格涵盖各种正则表达式风格,因此,如果不同的正则表达式风格使用相同的语法来表示不同的功能,此快速参考可能会针对相同的语法有多个项目,并链接到教学中的不同区段。

如果您已经知道您要的功能,但忘记要使用哪个语法,请改为在 正则表达式参考目录 中查找该功能。

语法功能
任何字符,除了 [\^$.|?*+()字面字符
\ 后接 [\^$.|?*+(){} 中的任何一个反斜线转义后设字符
.任何字符
|交替
\|交替
?贪婪量词
\?贪婪量词
??非贪婪量词
?+独占量词
*贪婪量词
*?非贪婪量词
*+独占量词
+贪婪量词
\+贪婪量词
+?非贪婪量词
++独占量词
{ 和 }字面大括号
{n},其中 n 为大于或等于 1 的整数固定量词
{n,m},其中 n 大于或等于 0,且 m 大于或等于 n贪婪量词
{n,},其中 n 大于或等于 0贪婪量词
{,m},其中 m 大于或等于 1贪婪量词
\{n\},其中 n 为大于或等于 1 的整数固定量词
\{n,m\},其中 n 大于或等于 0,且 m 大于或等于 n贪婪量词
\{n,\},其中 n 大于或等于 0贪婪量词
\{,m\},其中 m 大于或等于 1贪婪量词
{n,m}? 其中 n >= 0 且 m >= n非贪婪量词
{n,}? 其中 n >= 0非贪婪量词
{,m}? 其中 m >= 1非贪婪量词
{n,m}+ 其中 n >= 0 且 m >= n独占量词
{n,}+ 其中 n >= 0独占量词
^字符串锚定
^行锚定
$字符串锚定
$行锚定
\a字符转义
\A字符串锚定
\A尝试锚定
\b字词边界
\b退格字符
\B字词非边界
\B反斜线字符
\cXML 简写
\ca 至 \cz控制字符转义
\cA 至 \cZ控制字符转义
\CXML 简写
\d数字简写
\D非数字简写
\e转义字符
\f换页字符
\g{name}命名回溯参考
\g-1、\g-2 等相对回溯参考
\g{-1}、\g{-2} 等相对回溯参考
\g1 至 \g99回溯参考
\g{1} 至 \g{99}回溯参考
\g<name> 其中「name」是捕获组的名称命名子常式调用
\g<name> 其中「name」是捕获组的名称命名回溯参考
\g'name' 其中「name」是捕获组的名称命名子常式调用
\g'name' 其中「name」是捕获组的名称命名回溯参考
\g<0>递归
\g'0'递归
\g<1> 其中 1 是捕获组的号码子常式调用
\g<1> 其中 1 是捕获组的号码回溯参考
\g'1' 其中 1 是捕获组的号码子常式调用
\g'1' 其中 1 是捕获组的号码回溯参考
\g<-1> 其中 -1 是负整数相对子常式调用
\g<-1> 其中 -1 是负整数相对回溯参考
\g'-1' 其中 -1 是负整数相对子常式调用
\g'-1' 其中 -1 是负整数相对回溯参考
\g<+1> 其中 +1 是正整数前进子常式调用
\g'+1' 其中 +1 是正整数前进子常式调用
\G尝试锚定
\G比对锚定
\h十六进位数字简写
\h水平空白简写
\H非十六进位数字简写
\H非水平空白简写
\iXML 简写
\IXML 简写
\k<name>命名回溯参考
\k'name' 至 \k'99'命名回溯参考
\k{name}命名回溯参考
\k<1> 至 \k<99>回溯参考
\k'1' 至 \k'99'回溯参考
\k<-1>、\k<-2> 等相对回溯参考
\k'-1'、\k'-2' 等相对回溯参考
\K将文本保留在正则表达式比对之外
\l小写简写
\L非小写简写
\mTcl 前缀边界
\MTcl 后缀边界
\n换行字符
\N非换行
字面 CRLF、LF 或 CR 换行换行
\o{7777} 其中 7777 为任何八进制数字八进制转义
\pL 其中 L 为 Unicode 类别Unicode 类别
\PL 其中 L 为 Unicode 类别Unicode 类别
\p{L} 其中 L 为 Unicode 类别Unicode 类别
\p{IsL} 其中 L 为 Unicode 类别Unicode 类别
\p{Category}Unicode 类别
\p{IsCategory}Unicode 类别
\p{Script}Unicode 码
\p{IsScript}Unicode 码
\p{Block}Unicode 区块
\p{InBlock}Unicode 区块
\p{IsBlock}Unicode 区块
\P{Property}否定 Unicode 属性
\p{^Property}否定 Unicode 属性
\P{^Property}Unicode 属性
\Q…\E转义串行
\r回车字符
\R换行
\s空白简写
\S非空白简写
\t跳格字符
\u大写简写
\uFFFF 其中 FFFF 为 4 个十六进制数字Unicode 码点
\u{FFFF} 其中 FFFF 为 1 到 4 个十六进制数字Unicode 码点
\U非大写简写
\v垂直跳格字符
\v垂直空白简写
\V非垂直空白简写
\w字符简写
\W非字符简写
\xFF 其中 FF 为 2 个十六进制数字 十六进制转义
\xFFFF 其中 FFFF 为 4 个十六进制数字Unicode 码点
\x{FFFF} 其中 FFFF 为 1 到 4 个十六进制数字Unicode 码点
\XUnicode 字形
\yTcl 前缀边界
\YTcl 前缀非边界
\Z字符串锚定
\z字符串锚定
\0NULL 转义
\1 到 \7八进制转义
\1 到 \9回溯参考
\10 到 \77八进制转义
\10 到 \99回溯参考
\100 到 \377八进制转义
\01 到 \0377八进制转义
\<字符串锚定
\<尝试锚定
\'字符串锚定
\<GNU 前缀边界
\>GNU 前缀边界
[[:<:]]POSIX 前缀边界
[[:>:]]POSIX 前缀边界
(正则表达式)捕获组
\(regex\)捕获组
(?:regex)非捕获组
(?<name>regex)命名捕获组
(?'name'regex)命名捕获组
(?#comment)注解
(?|regex)分支重设群组
(?>regex)原子组
(?=regex)正向前瞻
(?!regex)负向前瞻
(?<=regex)正向后瞻
(?<!regex)负向后瞻
(?(?=regex)then|else) 其中 (?=regex) 是任何有效的环顾,而 then 和 else 是任何有效的正则表达式环顾条件式
(?(regex)then|else) 其中 regex、then 和 else 是任何有效的正则表达式,而 regex 不是捕获组的名称隐含前瞻条件式
(?(name)then|else) 其中 name 是捕获组的名称,而 then 和 else 是任何有效的正则表达式命名条件式
(?(<name>)then|else) 其中 name 是捕获组的名称,而 then 和 else 是任何有效的正则表达式命名条件式
(?('name')then|else) 其中 name 是捕获组的名称,而 then 和 else 是任何有效的正则表达式命名条件式
(?(1)then|else) 其中 1 是捕获组的数字,而 then 和 else 是任何有效的正则表达式条件式
(?(-1)then|else) 其中 -1 是负整数,而 then 和 else 是任何有效的正则表达式相对条件式
(?(+1)then|else) 其中 +1 是正整数,而 then 和 else 是任何有效的正则表达式前向条件式
(?(+1)then|else) 其中 1 是捕获组的数字,而 then 和 else 是任何有效的正则表达式条件式
(?<capture-subtract>regex) 其中「capture」和「subtract」是群组名称,而「regex」是任何正则表达式平衡组
(?'capture-subtract'regex) 其中「capture」和「subtract」是群组名称,而「regex」是任何正则表达式平衡组
(?&name) 其中「name」是捕获组的名称命名子常式调用
(?(DEFINE)regex) 其中「regex」是任何正则表达式子常式定义
(?P<name>regex)命名捕获组
(?P=name)命名回溯参考
(?P=1) 到 (?P=99)回溯参考
(?P>name) 其中「name」是捕获组的名称命名子常式调用
(?R)递归
(?0)递归
(?1) 其中 1 是捕获组的数字子常式调用
(?-1) 其中 -1 是负整数相对子常式调用
(?+1) 其中 +1 为正整数前进子常式调用

字符类别语法功能
任何字符,但 ^-]\ 除外字面字符
\ (反斜线) 后面接着 ^-]\ 中的任何一个字符反斜线转义后设字符
\反斜线字面值
- 出现在两个只指定单一字符的标记之间范围
^ 出现在打开 [ 之后否定字符类别
[打开方括号字面值
[嵌套字符类别
[base-[subtract]]字符类别减法
[base&&[intersect]]字符类别交集
[base&&intersect]字符类别交集
[:alpha:]POSIX 类别
[:^alpha:]否定 POSIX 类别
\p{Alpha}POSIX 类别
\p{IsAlpha}POSIX 类别
[.span-ll.]POSIX 排序串行
[=x=]POSIX 字符等价
正規表示式快速參考
  • 简
  • 繁
  • En
關於正規表示式 » 正規表示式參考 » 正規表示式快速參考

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

正規表示式快速參考

此快速參考是 完整參考表格 中列出的所有正規表示式語法的摘要,不含任何說明。如果您在別人的正規表示式中看到一些語法,但不知道該語法是哪個功能,可以使用此表格。請按連結進一步了解教學中的語法。由於完整參考表格涵蓋各種正規表示式風格,因此,如果不同的正規表示式風格使用相同的語法來表示不同的功能,此快速參考可能會針對相同的語法有多個項目,並連結到教學中的不同區段。

如果您已經知道您要的功能,但忘記要使用哪個語法,請改為在 正規表示式參考目錄 中查詢該功能。

語法功能
任何字元,除了 [\^$.|?*+()字面字元
\ 後接 [\^$.|?*+(){} 中的任何一個反斜線跳脫後設字元
.任何字元
|交替
\|交替
?貪婪量詞
\?貪婪量詞
??非貪婪量詞
?+獨佔量詞
*貪婪量詞
*?非貪婪量詞
*+獨佔量詞
+貪婪量詞
\+貪婪量詞
+?非貪婪量詞
++獨佔量詞
{ 和 }字面大括號
{n},其中 n 為大於或等於 1 的整數固定量詞
{n,m},其中 n 大於或等於 0,且 m 大於或等於 n貪婪量詞
{n,},其中 n 大於或等於 0貪婪量詞
{,m},其中 m 大於或等於 1貪婪量詞
\{n\},其中 n 為大於或等於 1 的整數固定量詞
\{n,m\},其中 n 大於或等於 0,且 m 大於或等於 n貪婪量詞
\{n,\},其中 n 大於或等於 0貪婪量詞
\{,m\},其中 m 大於或等於 1貪婪量詞
{n,m}? 其中 n >= 0 且 m >= n非貪婪量詞
{n,}? 其中 n >= 0非貪婪量詞
{,m}? 其中 m >= 1非貪婪量詞
{n,m}+ 其中 n >= 0 且 m >= n獨佔量詞
{n,}+ 其中 n >= 0獨佔量詞
^字串錨定
^行錨定
$字串錨定
$行錨定
\a字元跳脫
\A字串錨定
\A嘗試錨定
\b字詞邊界
\b退格字元
\B字詞非邊界
\B反斜線字元
\cXML 簡寫
\ca 至 \cz控制字元跳脫
\cA 至 \cZ控制字元跳脫
\CXML 簡寫
\d數字簡寫
\D非數字簡寫
\e跳脫字元
\f換頁字元
\g{name}命名回溯參考
\g-1、\g-2 等相對回溯參考
\g{-1}、\g{-2} 等相對回溯參考
\g1 至 \g99回溯參考
\g{1} 至 \g{99}回溯參考
\g<name> 其中「name」是擷取群組的名稱命名子常式呼叫
\g<name> 其中「name」是擷取群組的名稱命名回溯參考
\g'name' 其中「name」是擷取群組的名稱命名子常式呼叫
\g'name' 其中「name」是擷取群組的名稱命名回溯參考
\g<0>遞迴
\g'0'遞迴
\g<1> 其中 1 是擷取群組的號碼子常式呼叫
\g<1> 其中 1 是擷取群組的號碼回溯參考
\g'1' 其中 1 是擷取群組的號碼子常式呼叫
\g'1' 其中 1 是擷取群組的號碼回溯參考
\g<-1> 其中 -1 是負整數相對子常式呼叫
\g<-1> 其中 -1 是負整數相對回溯參考
\g'-1' 其中 -1 是負整數相對子常式呼叫
\g'-1' 其中 -1 是負整數相對回溯參考
\g<+1> 其中 +1 是正整數前進子常式呼叫
\g'+1' 其中 +1 是正整數前進子常式呼叫
\G嘗試錨定
\G比對錨定
\h十六進位數字簡寫
\h水平空白簡寫
\H非十六進位數字簡寫
\H非水平空白簡寫
\iXML 簡寫
\IXML 簡寫
\k<name>命名回溯參考
\k'name' 至 \k'99'命名回溯參考
\k{name}命名回溯參考
\k<1> 至 \k<99>回溯參考
\k'1' 至 \k'99'回溯參考
\k<-1>、\k<-2> 等相對回溯參考
\k'-1'、\k'-2' 等相對回溯參考
\K將文字保留在正規表示式比對之外
\l小寫簡寫
\L非小寫簡寫
\mTcl 字首邊界
\MTcl 字尾邊界
\n換行字元
\N非換行
字面 CRLF、LF 或 CR 換行換行
\o{7777} 其中 7777 為任何八進制數字八進制跳脫
\pL 其中 L 為 Unicode 類別Unicode 類別
\PL 其中 L 為 Unicode 類別Unicode 類別
\p{L} 其中 L 為 Unicode 類別Unicode 類別
\p{IsL} 其中 L 為 Unicode 類別Unicode 類別
\p{Category}Unicode 類別
\p{IsCategory}Unicode 類別
\p{Script}Unicode 碼
\p{IsScript}Unicode 碼
\p{Block}Unicode 區塊
\p{InBlock}Unicode 區塊
\p{IsBlock}Unicode 區塊
\P{Property}否定 Unicode 屬性
\p{^Property}否定 Unicode 屬性
\P{^Property}Unicode 屬性
\Q…\E跳脫序列
\r回車字元
\R換行
\s空白簡寫
\S非空白簡寫
\t跳格字元
\u大寫簡寫
\uFFFF 其中 FFFF 為 4 個十六進制數字Unicode 碼點
\u{FFFF} 其中 FFFF 為 1 到 4 個十六進制數字Unicode 碼點
\U非大寫簡寫
\v垂直跳格字元
\v垂直空白簡寫
\V非垂直空白簡寫
\w字元簡寫
\W非字元簡寫
\xFF 其中 FF 為 2 個十六進制數字 十六進制跳脫
\xFFFF 其中 FFFF 為 4 個十六進制數字Unicode 碼點
\x{FFFF} 其中 FFFF 為 1 到 4 個十六進制數字Unicode 碼點
\XUnicode 字形
\yTcl 字首邊界
\YTcl 字首非邊界
\Z字串錨定
\z字串錨定
\0NULL 跳脫
\1 到 \7八進制跳脫
\1 到 \9回溯參考
\10 到 \77八進制跳脫
\10 到 \99回溯參考
\100 到 \377八進制跳脫
\01 到 \0377八進制跳脫
\<字串錨定
\<嘗試錨定
\'字串錨定
\<GNU 字首邊界
\>GNU 字首邊界
[[:<:]]POSIX 字首邊界
[[:>:]]POSIX 字首邊界
(正規表示式)擷取群組
\(regex\)擷取群組
(?:regex)非擷取群組
(?<name>regex)命名擷取群組
(?'name'regex)命名擷取群組
(?#comment)註解
(?|regex)分支重設群組
(?>regex)原子群組
(?=regex)正向前瞻
(?!regex)負向前瞻
(?<=regex)正向後瞻
(?<!regex)負向後瞻
(?(?=regex)then|else) 其中 (?=regex) 是任何有效的環顧,而 then 和 else 是任何有效的正規表示式環顧條件式
(?(regex)then|else) 其中 regex、then 和 else 是任何有效的正規表示式,而 regex 不是擷取群組的名稱隱含前瞻條件式
(?(name)then|else) 其中 name 是擷取群組的名稱,而 then 和 else 是任何有效的正規表示式命名條件式
(?(<name>)then|else) 其中 name 是擷取群組的名稱,而 then 和 else 是任何有效的正規表示式命名條件式
(?('name')then|else) 其中 name 是擷取群組的名稱,而 then 和 else 是任何有效的正規表示式命名條件式
(?(1)then|else) 其中 1 是擷取群組的數字,而 then 和 else 是任何有效的正規表示式條件式
(?(-1)then|else) 其中 -1 是負整數,而 then 和 else 是任何有效的正規表示式相對條件式
(?(+1)then|else) 其中 +1 是正整數,而 then 和 else 是任何有效的正規表示式前向條件式
(?(+1)then|else) 其中 1 是擷取群組的數字,而 then 和 else 是任何有效的正規表示式條件式
(?<capture-subtract>regex) 其中「capture」和「subtract」是群組名稱,而「regex」是任何正規表示式平衡群組
(?'capture-subtract'regex) 其中「capture」和「subtract」是群組名稱,而「regex」是任何正規表示式平衡群組
(?&name) 其中「name」是擷取群組的名稱命名子常式呼叫
(?(DEFINE)regex) 其中「regex」是任何正規表示式子常式定義
(?P<name>regex)命名擷取群組
(?P=name)命名回溯參考
(?P=1) 到 (?P=99)回溯參考
(?P>name) 其中「name」是擷取群組的名稱命名子常式呼叫
(?R)遞迴
(?0)遞迴
(?1) 其中 1 是擷取群組的數字子常式呼叫
(?-1) 其中 -1 是負整數相對子常式呼叫
(?+1) 其中 +1 為正整數前進子常式呼叫

字元類別語法功能
任何字元,但 ^-]\ 除外字面字元
\ (反斜線) 後面接著 ^-]\ 中的任何一個字元反斜線跳脫後設字元
\反斜線字面值
- 出現在兩個只指定單一字元的標記之間範圍
^ 出現在開啟 [ 之後否定字元類別
[開啟方括號字面值
[巢狀字元類別
[base-[subtract]]字元類別減法
[base&&[intersect]]字元類別交集
[base&&intersect]字元類別交集
[:alpha:]POSIX 類別
[:^alpha:]否定 POSIX 類別
\p{Alpha}POSIX 類別
\p{IsAlpha}POSIX 類別
[.span-ll.]POSIX 排序序列
[=x=]POSIX 字元等價
Regular Expressions Quick Reference
  • 简
  • 繁
  • En
About Regular Expressions » Regular Expressions Reference » Regular Expressions Quick 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 Quick Reference

This quick reference is a summary of all the regex syntax that is listed in the full reference tables, without any explanation. You can use this table if you’ve seen some syntax in somebody else’s regex and you have no idea what feature that syntax is for. Follow the link to learn more about the syntax in the tutorial. Since the full reference tables cover a variety of regex flavors, this quick reference may have multiple entries for the same syntax with links to different sections in the tutorial if different regex flavors use the same syntax for different features.

If you already know the feature you want but forgot which syntax to use, look up the feature in the regex reference table of contents instead.

SyntaxFeature
Any character except [\^$.|?*+()Literal character
\ followed by any of [\^$.|?*+(){}Backslash escapes a metacharacter
.Any character
|Alternation
\|Alternation
?Greedy quantifier
\?Greedy quantifier
??Lazy quantifier
?+Possessive quantifier
*Greedy quantifier
*?Lazy quantifier
*+Possessive quantifier
+Greedy quantifier
\+Greedy quantifier
+?Lazy quantifier
++Possessive quantifier
{ and }Literal curly braces
{n} where n is an integer >= 1Fixed quantifier
{n,m} where n >= 0 and m >= nGreedy quantifier
{n,} where n >= 0Greedy quantifier
{,m} where m >= 1Greedy quantifier
\{n\} where n is an integer >= 1Fixed quantifier
\{n,m\} where n >= 0 and m >= nGreedy quantifier
\{n,\} where n >= 0Greedy quantifier
\{,m\} where m >= 1Greedy quantifier
{n,m}? where n >= 0 and m >= nLazy quantifier
{n,}? where n >= 0Lazy quantifier
{,m}? where m >= 1Lazy quantifier
{n,m}+ where n >= 0 and m >= nPossessive quantifier
{n,}+ where n >= 0Possessive quantifier
^String anchor
^Line anchor
$String anchor
$Line anchor
\aCharacter escape
\AString anchor
\AAttempt anchor
\bWord boundary
\bBackspace character
\BWord non-boundary
\BBackslash character
\cXML shorthand
\ca through \czControl character escape
\cA through \cZControl character escape
\CXML shorthand
\dDigits shorthand
\DNon-digits shorthand
\eEscape character
\fForm feed character
\g{name}Named backreference
\g-1, \g-2, etc.Relative Backreference
\g{-1}, \g{-2}, etc.Relative Backreference
\g1 through \g99Backreference
\g{1} through \g{99}Backreference
\g<name> where “name” is the name of a capturing groupNamed subroutine call
\g<name> where “name” is the name of a capturing groupNamed backreference
\g'name' where “name” is the name of a capturing groupNamed subroutine call
\g'name' where “name” is the name of a capturing groupNamed backreference
\g<0>Recursion
\g'0'Recursion
\g<1> where 1 is the number of a capturing groupSubroutine call
\g<1> where 1 is the number of a capturing groupBackreference
\g'1' where 1 is the number of a capturing groupSubroutine call
\g'1' where 1 is the number of a capturing groupBackreference
\g<-1> where -1 is a negative integerRelative subroutine call
\g<-1> where -1 is a negative integerRelative backreference
\g'-1' where -1 is a negative integerRelative subroutine call
\g'-1' where -1 is a negative integerRelative backreference
\g<+1> where +1 is a positive integerForward subroutine call
\g'+1' where +1 is a positive integerForward subroutine call
\GAttempt anchor
\GMatch anchor
\hHexadecimal digit shorthand
\hHorizontal whitespace shorthand
\HNon-hexadecimal digit shorthand
\HNon-horizontal whitespace shorthand
\iXML shorthand
\IXML shorthand
\k<name>Named backreference
\k'name' through \k'99'Named backreference
\k{name}Named backreference
\k<1> through \k<99>Backreference
\k'1' through \k'99'Backreference
\k<-1>, \k<-2>, etc.Relative Backreference
\k'-1', \k'-2', etc.Relative Backreference
\KKeep text out of the regex match
\lLowercase shorthand
\LNon-lowercase shorthand
\mTcl start of word boundary
\MTcl end of word boundary
\nLine feed character
\NNot a line break
Literal CRLF, LF, or CR line breakLine break
\o{7777} where 7777 is any octal numberOctal escape
\pL where L is a Unicode categoryUnicode category
\PL where L is a Unicode categoryUnicode category
\p{L} where L is a Unicode categoryUnicode category
\p{IsL} where L is a Unicode categoryUnicode category
\p{Category}Unicode category
\p{IsCategory}Unicode category
\p{Script}Unicode script
\p{IsScript}Unicode script
\p{Block}Unicode block
\p{InBlock}Unicode block
\p{IsBlock}Unicode block
\P{Property}Negated Unicode property
\p{^Property}Negated Unicode property
\P{^Property}Unicode property
\Q…\EEscape sequence
\rCarriage return character
\RLine break
\sWhitespace shorthand
\SNon-whitespace shorthand
\tTab character
\uUppercase shorthand
\uFFFF where FFFF are 4 hexadecimal digitsUnicode code point
\u{FFFF} where FFFF are 1 to 4 hexadecimal digitsUnicode code point
\UNon-uppercase shorthand
\vVertical tab character
\vVertical whitespace shorthand
\VNon-vertical whitespace shorthand
\wWord character shorthand
\WNon-word character shorthand
\xFF where FF are 2 hexadecimal digits Hexadecimal escape
\xFFFF where FFFF are 4 hexadecimal digitsUnicode code point
\x{FFFF} where FFFF are 1 to 4 hexadecimal digitsUnicode code point
\XUnicode grapheme
\yTcl word boundary
\YTcl word non-boundary
\ZString anchor
\zString anchor
\0NULL escape
\1 through \7Octal escape
\1 through \9Backreference
\10 through \77Octal escape
\10 through \99Backreference
\100 through \377Octal escape
\01 through \0377Octal escape
\`String anchor
\`Attempt anchor
\'String anchor
\<GNU word boundary
\>GNU word boundary
[[:<:]]POSIX word boundary
[[:>:]]POSIX word boundary
(regex)Capturing group
\(regex\)Capturing group
(?:regex)Non-capturing group
(?<name>regex)Named capturing group
(?'name'regex)Named capturing group
(?#comment)Comment
(?|regex)Branch reset group
(?>regex)Atomic group
(?=regex)Positive lookahead
(?!regex)Negative lookahead
(?<=regex)Positive lookbehind
(?<!regex)Negative lookbehind
(?(?=regex)then|else) where (?=regex) is any valid lookaround and then and else are any valid regexesLookaround conditional
(?(regex)then|else) where regex, then, and else are any valid regexes and regex is not the name of a capturing groupImplicit lookahead conditional
(?(name)then|else) where name is the name of a capturing group and then and else are any valid regexesNamed conditional
(?(<name>)then|else) where name is the name of a capturing group and then and else are any valid regexesNamed conditional
(?('name')then|else) where name is the name of a capturing group and then and else are any valid regexesNamed conditional
(?(1)then|else) where 1 is the number of a capturing group and then and else are any valid regexesConditional
(?(-1)then|else) where -1 is a negative integer and then and else are any valid regexesRelative conditional
(?(+1)then|else) where +1 is a positive integer and then and else are any valid regexesForward conditional
(?(+1)then|else) where 1 is the number of a capturing group and then and else are any valid regexesConditional
(?<capture-subtract>regex) where “capture” and “subtract” are group names and “regex” is any regexBalancing group
(?'capture-subtract'regex) where “capture” and “subtract” are group names and “regex” is any regexBalancing group
(?&name) where “name” is the name of a capturing groupNamed subroutine call
(?(DEFINE)regex) where “regex” is any regexSubroutine definitions
(?P<name>regex)Named capturing group
(?P=name)Named backreference
(?P=1) through (?P=99)Backreference
(?P>name) where “name” is the name of a capturing groupNamed subroutine call
(?R)Recursion
(?0)Recursion
(?1) where 1 is the number of a capturing groupSubroutine call
(?-1) where -1 is a negative integerRelative subroutine call
(?+1) where +1 is a positive integerForward subroutine call

Character Class SyntaxFeature
Any character except ^-]\Literal character
\ (backslash) followed by any of ^-]\Backslash escapes a metacharacter
\Literal backslash
- between two tokens that each specify a single characterRange
^ immediately after the opening [Negated character class
[Literal opening bracket
[Nested character class
[base-[subtract]]Character class subtraction
[base&&[intersect]]Character class intersection
[base&&intersect]Character class intersection
[:alpha:]POSIX class
[:^alpha:]Negated POSIX class
\p{Alpha}POSIX class
\p{IsAlpha}POSIX class
[.span-ll.]POSIX collation sequence
[=x=]POSIX character equivalence
©2015-2025 艾丽卡 support@alaica.com