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

加载更多搜索结果...

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

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

正则表达式参考:锚点

功能语法说明范例.NET Java Perl PCRE PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE POSIX BRE POSIX ERE GNU BRE GNU ERE Oracle XML XPath
字符串锚点 ^ (插入符号) 与正则表达式模式套用的字符串开头相符。 ^. 在 abc\ndef 中与 a 相符 是是是是是是是是是是是是是是是是是是是是是否是
字符串锚点 $ (美元符号) 与正则表达式模式套用的字符串结尾相符。 .$ 在 abc\ndef 中与 f 相符 是是是是是是是是是是是是是是是是是是是是是否是
字符串锚点 $ (美元符号) 除了与字符串最末端相符外,也与字符串中最后一个换行符号(若有)之前相符。 .$ 在 abc\ndef\n 中与 f 相符 是是是是是是是是否否否是否否否否否否否否否不适用否
行锚定 ^ (插入符号) 除了在字符串开头比对外,还会在每个换行符号后比对,因此会比对字符串中每行的开头。 ^. 会在 abc\ndef 中比对到 a 和 d 选项选项选项选项选项选项选项选项选项选项选项选项是是基本
延伸
grep
egrep
awk
选项选项选项选项选项选项不适用选项
行锚定 $ (美元符号) 除了在字符串结尾比对外,还会在每个换行符号前比对,因此会比对字符串中每行的结尾。 .$ 会在 abc\ndef 中比对到 c 和 f 选项选项选项选项选项选项选项选项选项选项选项选项是是基本
延伸
grep
egrep
awk
选项选项选项选项选项选项不适用选项
字符串锚点 \A 与正则表达式模式套用的字符串开头相符。 \A\w 只会在 abc 中比对到 a 是是是是是是是是否否否是是否ECMA
延伸
egrep
awk
否否否否否10gR2否否
尝试锚定 \A 在比对尝试的开头比对。 \A\w 会在 abc def 中反复比对所有比对时比对到 a、b 和 c 否否否否否否否否否否否否否否否是否否否否否否否
尝试锚定 \G 在比对尝试的开头比对。 \G\w 会在 abc def 中反复比对所有比对时比对到 a、b 和 c 否否否4.0–7.9否是是是否否否否是否否否否否否否否否否
比对锚定 \G 在第二次及后续的比对尝试中,比对前一次比对的结尾。在第一次比对尝试中,比对字符串的开头。 \G\w 会在 abc def 中反复比对所有比对时比对到 a、b 和 c 是是是8.00是否否否否否否否否否ECMA
延伸
egrep
awk
否否否否否否否否
字符串锚点 \z 与正则表达式模式套用的字符串结尾相符。 \w\z 会在 abc\ndef 中比对到 f,但无法比对到 abc\ndef\n 是是是是是是是是否否否否是否ECMA
延伸
egrep
awk
否否否否否10gR2否否
字符串锚点 \Z 与正则表达式模式套用的字符串结尾相符。 \w\Z 会在 abc\ndef 中比对到 f,但无法比对到 abc\ndef\n 或 abc\ndef\n\n 否否否否否否否否否否否是否否否是否否否否否否否
字符串锚点 \Z 比对字符串结尾以及字符串中最后一个换行符号之前的位置(如果有)。 .\Z 在 abc\ndef 中比对到 f,在 abc\ndef\n 中也比对到,但无法在 abc\ndef\n\n 中比对到 是是是是是是是是否否否否是否否否否否否否10gR2否否
字符串锚点 \Z 比对字符串结尾,以及字符串中所有尾随换行符号之前(如果有的话) .\Z 在 abc\ndef 中比对到 f,在 abc\ndef\n 中也比对到,在 abc\ndef\n\n 中也比对到 否否否否否否否否否否否否否否ECMA
延伸
egrep
awk
否否否否否否否否
字符串锚点 \`(反斜线反引号) 与正则表达式模式套用的字符串开头相符。 \`\w 在 abc 中只比对到 a 否否否否否否否否否否否否否否ECMA
延伸
egrep
awk
否否否否否否否否
尝试锚定 \`(反斜线反引号) 在比对尝试的开头比对。 \`\w 在 abc def 中反复比对所有比对时,比对到 a、b 和 c 否否否否否否否否否否否否否否否否否否是是否否否
字符串锚点 \'(反斜线单引号) 与正则表达式模式套用的字符串结尾相符。 \w\' 在 abc\ndef 中比对到 f,但在 abc\ndef\n 中无法比对到 否否否否否否否否否否否否否否ECMA
延伸
egrep
awk
否否否是是否否否
功能语法说明范例.NET Java Perl PCRE PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE POSIX BRE POSIX ERE GNU BRE GNU ERE Oracle XML XPath
正規表示式參考:錨點
  • 简
  • 繁
  • En
關於正規表示式 » 正規表示式參考 » 正規表示式參考:錨點

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

正規表示式參考:錨點

功能語法說明範例.NET Java Perl PCRE PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE POSIX BRE POSIX ERE GNU BRE GNU ERE Oracle XML XPath
字串錨點 ^ (插入符號) 與正規表示式模式套用的字串開頭相符。 ^. 在 abc\ndef 中與 a 相符 是是是是是是是是是是是是是是是是是是是是是否是
字串錨點 $ (美元符號) 與正規表示式模式套用的字串結尾相符。 .$ 在 abc\ndef 中與 f 相符 是是是是是是是是是是是是是是是是是是是是是否是
字串錨點 $ (美元符號) 除了與字串最末端相符外,也與字串中最後一個換行符號(若有)之前相符。 .$ 在 abc\ndef\n 中與 f 相符 是是是是是是是是否否否是否否否否否否否否否不適用否
行錨定 ^ (插入符號) 除了在字串開頭比對外,還會在每個換行符號後比對,因此會比對字串中每行的開頭。 ^. 會在 abc\ndef 中比對到 a 和 d 選項選項選項選項選項選項選項選項選項選項選項選項是是基本
延伸
grep
egrep
awk
選項選項選項選項選項選項不適用選項
行錨定 $ (美元符號) 除了在字串結尾比對外,還會在每個換行符號前比對,因此會比對字串中每行的結尾。 .$ 會在 abc\ndef 中比對到 c 和 f 選項選項選項選項選項選項選項選項選項選項選項選項是是基本
延伸
grep
egrep
awk
選項選項選項選項選項選項不適用選項
字串錨點 \A 與正規表示式模式套用的字串開頭相符。 \A\w 只會在 abc 中比對到 a 是是是是是是是是否否否是是否ECMA
延伸
egrep
awk
否否否否否10gR2否否
嘗試錨定 \A 在比對嘗試的開頭比對。 \A\w 會在 abc def 中反覆比對所有比對時比對到 a、b 和 c 否否否否否否否否否否否否否否否是否否否否否否否
嘗試錨定 \G 在比對嘗試的開頭比對。 \G\w 會在 abc def 中反覆比對所有比對時比對到 a、b 和 c 否否否4.0–7.9否是是是否否否否是否否否否否否否否否否
比對錨定 \G 在第二次及後續的比對嘗試中,比對前一次比對的結尾。在第一次比對嘗試中,比對字串的開頭。 \G\w 會在 abc def 中反覆比對所有比對時比對到 a、b 和 c 是是是8.00是否否否否否否否否否ECMA
延伸
egrep
awk
否否否否否否否否
字串錨點 \z 與正規表示式模式套用的字串結尾相符。 \w\z 會在 abc\ndef 中比對到 f,但無法比對到 abc\ndef\n 是是是是是是是是否否否否是否ECMA
延伸
egrep
awk
否否否否否10gR2否否
字串錨點 \Z 與正規表示式模式套用的字串結尾相符。 \w\Z 會在 abc\ndef 中比對到 f,但無法比對到 abc\ndef\n 或 abc\ndef\n\n 否否否否否否否否否否否是否否否是否否否否否否否
字串錨點 \Z 比對字串結尾以及字串中最後一個換行符號之前的位置(如果有)。 .\Z 在 abc\ndef 中比對到 f,在 abc\ndef\n 中也比對到,但無法在 abc\ndef\n\n 中比對到 是是是是是是是是否否否否是否否否否否否否10gR2否否
字串錨點 \Z 比對字串結尾,以及字串中所有尾隨換行符號之前(如果有的話) .\Z 在 abc\ndef 中比對到 f,在 abc\ndef\n 中也比對到,在 abc\ndef\n\n 中也比對到 否否否否否否否否否否否否否否ECMA
延伸
egrep
awk
否否否否否否否否
字串錨點 \`(反斜線反引號) 與正規表示式模式套用的字串開頭相符。 \`\w 在 abc 中只比對到 a 否否否否否否否否否否否否否否ECMA
延伸
egrep
awk
否否否否否否否否
嘗試錨定 \`(反斜線反引號) 在比對嘗試的開頭比對。 \`\w 在 abc def 中反覆比對所有比對時,比對到 a、b 和 c 否否否否否否否否否否否否否否否否否否是是否否否
字串錨點 \'(反斜線單引號) 與正規表示式模式套用的字串結尾相符。 \w\' 在 abc\ndef 中比對到 f,但在 abc\ndef\n 中無法比對到 否否否否否否否否否否否否否否ECMA
延伸
egrep
awk
否否否是是否否否
功能語法說明範例.NET Java Perl PCRE PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE POSIX BRE POSIX ERE GNU BRE GNU ERE Oracle XML XPath
Regular Expression Reference: Anchors
  • 简
  • 繁
  • En
About Regular Expressions » Regular Expressions Reference » Regular Expression Reference: Anchors

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 Expression Reference: Anchors

FeatureSyntaxDescriptionExample.NET Java Perl PCRE PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE POSIX BRE POSIX ERE GNU BRE GNU ERE Oracle XML XPath
String anchor ^ (caret) Matches at the start of the string the regex pattern is applied to. ^. matches a in abc\ndef YESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESnoYES
String anchor $ (dollar) Matches at the end of the string the regex pattern is applied to. .$ matches f in abc\ndef YESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESnoYES
String anchor $ (dollar) Matches before the final line break in the string (if any) in addition to matching at the very end of the string. .$ matches f in abc\ndef\n YESYESYESYESYESYESYESYESnononoYESnononononononononon/ano
Line anchor ^ (caret) Matches after each line break in addition to matching at the start of the string, thus matching at the start of each line in the string. ^. matches a and d in abc\ndef optionoptionoptionoptionoptionoptionoptionoptionoptionoptionoptionoptionYESYESbasic
extended
grep
egrep
awk
optionoptionoptionoptionoptionoptionn/aoption
Line anchor $ (dollar) Matches before each line break in addition to matching at the end of the string, thus matching at the end of each line in the string. .$ matches c and f in abc\ndef optionoptionoptionoptionoptionoptionoptionoptionoptionoptionoptionoptionYESYESbasic
extended
grep
egrep
awk
optionoptionoptionoptionoptionoptionn/aoption
String anchor \A Matches at the start of the string the regex pattern is applied to. \A\w matches only a in abc YESYESYESYESYESYESYESYESnononoYESYESnoECMA
extended
egrep
awk
nonononono10gR2nono
Attempt anchor \A Matches at the start of the match attempt. \A\w matches a, b, and c when iterating over all matches in abc def nononononononononononononononoYESnonononononono
Attempt anchor \G Matches at the start of the match attempt. \G\w matches a, b, and c when iterating over all matches in abc def nonono4.0–7.9noYESYESYESnonononoYESnononononononononono
Match anchor \G Matches at the end of the previous match during the second and following match attempts. Matches at the start of the string during the first match attempt. \G\w matches a, b, and c when iterating over all matches in abc def YESYESYES8.00YESnononononononononoECMA
extended
egrep
awk
nononononononono
String anchor \z Matches at the end of the string the regex pattern is applied to. \w\z matches f in abc\ndef but fails to match abc\ndef\n YESYESYESYESYESYESYESYESnonononoYESnoECMA
extended
egrep
awk
nonononono10gR2nono
String anchor \Z Matches at the end of the string the regex pattern is applied to. \w\Z matches f in abc\ndef but fails to match abc\ndef\n or abc\ndef\n\n nononononononononononoYESnononoYESnonononononono
String anchor \Z Matches at the end of the string as well as before the final line break in the string (if any). .\Z matches f in abc\ndef and in abc\ndef\n but fails to match abc\ndef\n\n YESYESYESYESYESYESYESYESnonononoYESnonononononono10gR2nono
String anchor \Z Matches at the end of the string as well as before all trailing line breaks in the string (if any). .\Z matches f in abc\ndef and in abc\ndef\n and in abc\ndef\n\n nonononononononononononononoECMA
extended
egrep
awk
nononononononono
String anchor \` (backslash backtick) Matches at the start of the string the regex pattern is applied to. \`\w matches only a in abc nonononononononononononononoECMA
extended
egrep
awk
nononononononono
Attempt anchor \` (backslash backtick) Matches at the start of the match attempt. \`\w matches a, b, and c when iterating over all matches in abc def nonononononononononononononononononoYESYESnonono
String anchor \' (backslash quote) Matches at the end of the string the regex pattern is applied to. \w\' matches f in abc\ndef but fails to match abc\ndef\n nonononononononononononononoECMA
extended
egrep
awk
nononoYESYESnonono
FeatureSyntaxDescriptionExample.NET Java Perl PCRE PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE POSIX BRE POSIX ERE GNU BRE GNU ERE Oracle XML XPath
©2015-2025 艾丽卡 support@alaica.com