替换字符串参考:内容和大小写转换替换字符串参考:内容和大小写转换替换字符串参考:内容和大小写转换替换字符串参考:内容和大小写转换
  • 文章
  • 正则表达式
    • 工具
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容
发表 admin at 2024年3月5日
类别
  • 正则表达式
标签
替换字符串参考:内容和大小写转换
  • 简
  • 繁
  • En
关于正则表达式 » 正则表达式参考 » 替换字符串参考 » 替换字符串参考:内容和大小写转换

替换参考
简介
目录
字符
符合文本和反向引用
内容和大小写转换
条件式
正则表达式参考
此网站的更多信息
简介
正则表达式快速开始
正则表达式教程
替换字符串教程
应用程序和语言
正则表达式范例
正则表达式参考
替换字符串参考

替换字符串参考:内容和大小写转换

功能语法说明范例.NET Java Perl PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE Oracle XPath
符合内容 \` (反斜线反引号) 插入正则表达式符合项目左边的主题字符串部分 将 b 替换为 \`,在 abc 中会产生 aac nononononoYESnononononoYESnonononoerror
符合内容 $` (美元反引号) 插入正则表达式符合项目左边的主题字符串部分 将 b 替换为 $`,在 abc 中会产生 aac YESerrorYESerrornoYESnoYESYESYESnonodefaultall
default
nonoerror
符合内容 $PREMATCH 和 ${^PREMATCH} 插入正则表达式符合项目左边的主题字符串部分 将 b 替换为 $PREMATCH,在 abc 中会产生 aac noerrorerrorerrornononononoerrornononoall
default
1.42–1.83
nonoerror
符合内容 \' (反斜线单引号) 插入正则表达式符合项目右边的主题字符串部分 将 b 替换为 \',在 abc 中会产生 acc nononononoYESnononononoYESnonononoerror
符合内容 $' (美元单引号) 插入正则表达式符合项目右边的主题字符串部分 将 b 替换为 $',在 abc 中会产生 acc YESerrorYESerrornoYESnoYESYESYESnonodefaultall
default
nonoerror
符合内容 $POSTMATCH 和 ${^POSTMATCH} 插入正则表达式符合项目右边的主题字符串部分 将 b 替换为 $POSTMATCH 在 abc 会产生 acc noerrorerrorerrornononononoerrornononoall
default
1.42–1.83
nonoerror
符合内容 \_ 插入整个主旨字符串 将 b 替换为 \_ 在 abc 会产生 aabcc nonononononononononononononononoerror
符合内容 $_ 插入整个主旨字符串 将 b 替换为 $_ 在 abc 会产生 aabcc YESerrorerrorerrornoYESnonoYESerrornonononononoerror
大小写转换 \U0 和 \U1 到 \U99 插入整个正则表达式比对或第 1 到第 99 个反向引用,并将比对文本中的所有字母转换为大写。 将 .+ 替换为 \U0 在 HeLlO WoRlD 会产生 HELLO WORLD nononononoYESnononono3.7–3.10 错误nononononoerror
大小写转换 \L0 和 \L1 到 \L99 插入整个正则表达式比对或第 1 到第 99 个反向引用,并将比对文本中的所有字母转换为小写。 将 .+ 替换为 \L0 在 HeLlO WoRlD 会产生 hello world nononononoYESnononono3.7–3.10 错误nononononoerror
大小写转换 \F0 和 \F1 到 \F99 插入整个正则表达式比对或第 1 到第 99 个反向引用,并将比对文本中的第一个字母转换为大写,其余字母转换为小写。 将 .+ 替换为 \F0 在 HeLlO WoRlD 会产生 Hello world nonono延伸错误noYESnononono3.7–3.10 错误nononononoerror
大小写转换 \I0 和 \I1 到 \I99 插入整个 regex 比对或第 1 到第 99 个反向引用,将比对文本中每个字的第一个字母转换为大写,其余字母转换为小写。 将 .+ 替换为 \I0,在 HeLlO WoRlD 中会产生 Hello World nonono延伸错误noYESnononono3.7–3.10 错误nononononoerror
大小写转换 \U 在 \U 之后,所有文本字面和所有由替换文本代码插入的文本,直到下一个 \E 或 \L,都会转换为大写。 将 (\w+) (\w+) 替换为 \U$1 CrUeL \E$2,在 HeLlO WoRlD 中会产生 HELLO CRUEL WoRlD nonoYES延伸nononononono3.7–3.10 错误nonoall
default
nonoerror
大小写转换 \L 在 \L 之后,所有文本字面和所有由替换文本代码插入的文本,直到下一个 \E 或 \U,都会转换为小写。 将 (\w+) (\w+) 替换为 \L$1 CrUeL \E$2,在 HeLlO WoRlD 中会产生 hello cruel WoRlD nonoYES延伸nononononono3.7–3.10 错误nonoall
default
nonoerror
大小写转换 \u 在 \u 之后,第一个插入替换文本的字符(文本字面或代码)会转换为大写。 将 (\w+) (\w+) 替换为 \u$1 \ucRuEl \u$2,在 hElLo wOrLd 中会产生 HElLO CRuEl WOrLd nonoYES延伸nononononono3.7–3.10 错误nonoall
default
nonoerror
大小写转换 \l 在 \l 之后,第一个插入替换文本的字符(文本字面或代码)会转换为小写。 将 (\w+) (\w+) 替换为 \l$1 \lCrUeL \l$2 在 HeLlO WoRlD 会产生 heLlO crUeL woRlD nonoYES延伸nononononono3.7–3.10 错误nonoall
default
nonoerror
大小写转换 \u\L 插入替换文本中第一个字符做为文本或符号的 \u\L 后,会将其转换成大写,而后续字符直到下一个 \E 或 \U 为止,都会转换成小写。 将 (\w+) (\w+) 替换为 \u\L$1 \uCrUeL \E\u$2 在 HeLlO wOrLd 会产生 Hello Cruel WOrLd nonoYESnonononononono3.7–3.10 错误nononononoerror
大小写转换 \l\U 插入替换文本中第一个字符做为文本或符号的 \l\U 后,会将其转换成小写,而后续字符直到下一个 \E 或 \L 为止,都会转换成大写。 将 (\w+) (\w+) 替换为 \l\U$1 \lCrUeL \E\l$2 在 HeLlO WoRlD 会产生 hELLO cRUEL woRlD nonoYESnonononononono3.7–3.10 错误nononononoerror
大小写转换 \L\u 插入替换文本中第一个字符做为文本或符号的 \L\u 后,会将其转换成大写,而后续字符直到下一个 \E 或 \U 为止,都会转换成小写。 将 (\w+) (\w+) 替换为 \L\u$1 \uCrUeL \E\u$2 在 HeLlO wOrLd 会产生 Hello Cruel WOrLd nononononononononono3.7–3.10 错误nonoall
default
nonoerror
大小写转换 \U\l 插入替换文本中第一个字符做为文本或符号的 \U\l 后,会将其转换成小写,而后续字符直到下一个 \E 或 \L 为止,都会转换成大写。 将 (\w+) (\w+) 替换为 \U\l$1 \lCrUeL \E\l$2 在 HeLlO WoRlD 中会产生 hELLO cRUEL woRlD nononononononononono3.7–3.10 错误nonoall
default
nonoerror
功能语法说明范例.NET Java Perl PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE Oracle XPath
替換字串參考:內容和大小寫轉換
  • 简
  • 繁
  • En
關於正規表示式 » 正規表示式參考 » 替換字串參考目錄 » 替換字串參考:內容和大小寫轉換

替換參考
簡介
目錄
字元
符合文字和反向參照
內容和大小寫轉換
條件式
正規表示式參考
此網站的更多資訊
簡介
正規表示式快速開始
正規表示式教學
替換字串教學
應用程式和語言
正規表示式範例
正規表示式參考
替換字串參考

替換字串參考:內容和大小寫轉換

功能語法說明範例.NET Java Perl PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE Oracle XPath
符合內容 \` (反斜線反引號) 插入正規表示式符合項目左邊的主題字串部分 將 b 替換為 \`,在 abc 中會產生 aac nononononoYESnononononoYESnonononoerror
符合內容 $` (美元反引號) 插入正規表示式符合項目左邊的主題字串部分 將 b 替換為 $`,在 abc 中會產生 aac YESerrorYESerrornoYESnoYESYESYESnonodefaultall
default
nonoerror
符合內容 $PREMATCH 和 ${^PREMATCH} 插入正規表示式符合項目左邊的主題字串部分 將 b 替換為 $PREMATCH,在 abc 中會產生 aac noerrorerrorerrornononononoerrornononoall
default
1.42–1.83
nonoerror
符合內容 \' (反斜線單引號) 插入正規表示式符合項目右邊的主題字串部分 將 b 替換為 \',在 abc 中會產生 acc nononononoYESnononononoYESnonononoerror
符合內容 $' (美元單引號) 插入正規表示式符合項目右邊的主題字串部分 將 b 替換為 $',在 abc 中會產生 acc YESerrorYESerrornoYESnoYESYESYESnonodefaultall
default
nonoerror
符合內容 $POSTMATCH 和 ${^POSTMATCH} 插入正規表示式符合項目右邊的主題字串部分 將 b 替換為 $POSTMATCH 在 abc 會產生 acc noerrorerrorerrornononononoerrornononoall
default
1.42–1.83
nonoerror
符合內容 \_ 插入整個主旨字串 將 b 替換為 \_ 在 abc 會產生 aabcc nonononononononononononononononoerror
符合內容 $_ 插入整個主旨字串 將 b 替換為 $_ 在 abc 會產生 aabcc YESerrorerrorerrornoYESnonoYESerrornonononononoerror
大小寫轉換 \U0 和 \U1 到 \U99 插入整個正規表示式比對或第 1 到第 99 個反向參照,並將比對文字中的所有字母轉換為大寫。 將 .+ 替換為 \U0 在 HeLlO WoRlD 會產生 HELLO WORLD nononononoYESnononono3.7–3.10 錯誤nononononoerror
大小寫轉換 \L0 和 \L1 到 \L99 插入整個正規表示式比對或第 1 到第 99 個反向參照,並將比對文字中的所有字母轉換為小寫。 將 .+ 替換為 \L0 在 HeLlO WoRlD 會產生 hello world nononononoYESnononono3.7–3.10 錯誤nononononoerror
大小寫轉換 \F0 和 \F1 到 \F99 插入整個正規表示式比對或第 1 到第 99 個反向參照,並將比對文字中的第一個字母轉換為大寫,其餘字母轉換為小寫。 將 .+ 替換為 \F0 在 HeLlO WoRlD 會產生 Hello world nonono延伸錯誤noYESnononono3.7–3.10 錯誤nononononoerror
大小寫轉換 \I0 和 \I1 到 \I99 插入整個 regex 比對或第 1 到第 99 個反向參照,將比對文字中每個字的第一個字母轉換為大寫,其餘字母轉換為小寫。 將 .+ 替換為 \I0,在 HeLlO WoRlD 中會產生 Hello World nonono延伸錯誤noYESnononono3.7–3.10 錯誤nononononoerror
大小寫轉換 \U 在 \U 之後,所有文字字面和所有由替換文字代碼插入的文字,直到下一個 \E 或 \L,都會轉換為大寫。 將 (\w+) (\w+) 替換為 \U$1 CrUeL \E$2,在 HeLlO WoRlD 中會產生 HELLO CRUEL WoRlD nonoYES延伸nononononono3.7–3.10 錯誤nonoall
default
nonoerror
大小寫轉換 \L 在 \L 之後,所有文字字面和所有由替換文字代碼插入的文字,直到下一個 \E 或 \U,都會轉換為小寫。 將 (\w+) (\w+) 替換為 \L$1 CrUeL \E$2,在 HeLlO WoRlD 中會產生 hello cruel WoRlD nonoYES延伸nononononono3.7–3.10 錯誤nonoall
default
nonoerror
大小寫轉換 \u 在 \u 之後,第一個插入替換文字的字元(文字字面或代碼)會轉換為大寫。 將 (\w+) (\w+) 替換為 \u$1 \ucRuEl \u$2,在 hElLo wOrLd 中會產生 HElLO CRuEl WOrLd nonoYES延伸nononononono3.7–3.10 錯誤nonoall
default
nonoerror
大小寫轉換 \l 在 \l 之後,第一個插入替換文字的字元(文字字面或代碼)會轉換為小寫。 將 (\w+) (\w+) 替換為 \l$1 \lCrUeL \l$2 在 HeLlO WoRlD 會產生 heLlO crUeL woRlD nonoYES延伸nononononono3.7–3.10 錯誤nonoall
default
nonoerror
大小寫轉換 \u\L 插入替換文字中第一個字元做為文字或符號的 \u\L 後,會將其轉換成大寫,而後續字元直到下一個 \E 或 \U 為止,都會轉換成小寫。 將 (\w+) (\w+) 替換為 \u\L$1 \uCrUeL \E\u$2 在 HeLlO wOrLd 會產生 Hello Cruel WOrLd nonoYESnonononononono3.7–3.10 錯誤nononononoerror
大小寫轉換 \l\U 插入替換文字中第一個字元做為文字或符號的 \l\U 後,會將其轉換成小寫,而後續字元直到下一個 \E 或 \L 為止,都會轉換成大寫。 將 (\w+) (\w+) 替換為 \l\U$1 \lCrUeL \E\l$2 在 HeLlO WoRlD 會產生 hELLO cRUEL woRlD nonoYESnonononononono3.7–3.10 錯誤nononononoerror
大小寫轉換 \L\u 插入替換文字中第一個字元做為文字或符號的 \L\u 後,會將其轉換成大寫,而後續字元直到下一個 \E 或 \U 為止,都會轉換成小寫。 將 (\w+) (\w+) 替換為 \L\u$1 \uCrUeL \E\u$2 在 HeLlO wOrLd 會產生 Hello Cruel WOrLd nononononononononono3.7–3.10 錯誤nonoall
default
nonoerror
大小寫轉換 \U\l 插入替換文字中第一個字元做為文字或符號的 \U\l 後,會將其轉換成小寫,而後續字元直到下一個 \E 或 \L 為止,都會轉換成大寫。 將 (\w+) (\w+) 替換為 \U\l$1 \lCrUeL \E\l$2 在 HeLlO WoRlD 中會產生 hELLO cRUEL woRlD nononononononononono3.7–3.10 錯誤nonoall
default
nonoerror
功能語法說明範例.NET Java Perl PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE Oracle XPath
Replacement Strings Reference: Context and Case Conversion
  • 简
  • 繁
  • En
About Regular Expressions » Regular Expressions Reference » Replacement Strings Reference » Replacement Strings Reference: Context and Case Conversion

Replacement Reference
Introduction
Table of Contents
Characters
Matched Text & Backreferences
Context & Case Conversion
Conditionals
Regular Expressions Reference
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

Replacement Strings Reference: Context and Case Conversion

FeatureSyntaxDescriptionExample.NET Java Perl PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE Oracle XPath
Match Context \` (backslash backtick) Insert the part of the subject string to the left of the regex match Replacing b with \` in abc yields aac nononononoYESnononononoYESnonononoerror
Match Context $` (dollar backtick) Insert the part of the subject string to the left of the regex match Replacing b with $` in abc yields aac YESerrorYESerrornoYESnoYESYESYESnonodefaultall
default
nonoerror
Match Context $PREMATCH and ${^PREMATCH} Insert the part of the subject string to the left of the regex match Replacing b with $PREMATCH in abc yields aac noerrorerrorerrornononononoerrornononoall
default
1.42–1.83
nonoerror
Match Context \' (backslash quote) Insert the part of the subject string to the right of the regex match Replacing b with \' in abc yields acc nononononoYESnononononoYESnonononoerror
Match Context $' (dollar quote) Insert the part of the subject string to the right of the regex match Replacing b with $' in abc yields acc YESerrorYESerrornoYESnoYESYESYESnonodefaultall
default
nonoerror
Match Context $POSTMATCH and ${^POSTMATCH} Insert the part of the subject string to the right of the regex match Replacing b with $POSTMATCH in abc yields acc noerrorerrorerrornononononoerrornononoall
default
1.42–1.83
nonoerror
Match Context \_ Insert the whole subject string Replacing b with \_ in abc yields aabcc nonononononononononononononononoerror
Match Context $_ Insert the whole subject string Replacing b with $_ in abc yields aabcc YESerrorerrorerrornoYESnonoYESerrornonononononoerror
Case Conversion \U0 and \U1 through \U99 Insert the whole regex match or the 1st through 99th backreference with all letters in the matched text converted to uppercase. Replacing .+ with \U0 in HeLlO WoRlD yields HELLO WORLD nononononoYESnononono3.7–3.10 errornononononoerror
Case Conversion \L0 and \L1 through \L99 Insert the whole regex match or the 1st through 99th backreference with all letters in the matched text converted to lowercase. Replacing .+ with \L0 in HeLlO WoRlD yields hello world nononononoYESnononono3.7–3.10 errornononononoerror
Case Conversion \F0 and \F1 through \F99 Insert the whole regex match or the 1st through 99th backreference with the first letter in the matched text converted to uppercase and the remaining letters converted to lowercase. Replacing .+ with \F0 in HeLlO WoRlD yields Hello world nononoextended errornoYESnononono3.7–3.10 errornononononoerror
Case Conversion \I0 and \I1 through \I99 Insert the whole regex match or the 1st through 99th backreference with the first letter of each word in the matched text converted to uppercase and the remaining letters converted to lowercase. Replacing .+ with \I0 in HeLlO WoRlD yields Hello World nononoextended errornoYESnononono3.7–3.10 errornononononoerror
Case Conversion \U All literal text and all text inserted by replacement text tokens after \U up to the next \E or \L is converted to uppercase. Replacing (\w+) (\w+) with \U$1 CrUeL \E$2 in HeLlO WoRlD yields HELLO CRUEL WoRlD nonoYESextendednononononono3.7–3.10 errornonoall
default
nonoerror
Case Conversion \L All literal text and all text inserted by replacement text tokens after \L up to the next \E or \U is converted to lowercase. Replacing (\w+) (\w+) with \L$1 CrUeL \E$2 in HeLlO WoRlD yields hello cruel WoRlD nonoYESextendednononononono3.7–3.10 errornonoall
default
nonoerror
Case Conversion \u The first character after \u that is inserted into the replacement text as a literal or by a token is converted to uppercase. Replacing (\w+) (\w+) with \u$1 \ucRuEl \u$2 in hElLo wOrLd yields HElLO CRuEl WOrLd nonoYESextendednononononono3.7–3.10 errornonoall
default
nonoerror
Case Conversion \l The first character after \l that is inserted into the replacement text as a literal or by a token is converted to lowercase. Replacing (\w+) (\w+) with \l$1 \lCrUeL \l$2 in HeLlO WoRlD yields heLlO crUeL woRlD nonoYESextendednononononono3.7–3.10 errornonoall
default
nonoerror
Case Conversion \u\L The first character after \u\L that is inserted into the replacement text as a literal or by a token is converted to uppercase and the following characters up to the next \E or \U are converted to lowercase. Replacing (\w+) (\w+) with \u\L$1 \uCrUeL \E\u$2 in HeLlO wOrLd yields Hello Cruel WOrLd nonoYESnonononononono3.7–3.10 errornononononoerror
Case Conversion \l\U The first character after \l\U that is inserted into the replacement text as a literal or by a token is converted to lowercase and the following characters up to the next \E or \L are converted to uppercase. Replacing (\w+) (\w+) with \l\U$1 \lCrUeL \E\l$2 in HeLlO WoRlD yields hELLO cRUEL woRlD nonoYESnonononononono3.7–3.10 errornononononoerror
Case Conversion \L\u The first character after \L\u that is inserted into the replacement text as a literal or by a token is converted to uppercase and the following characters up to the next \E or \U are converted to lowercase. Replacing (\w+) (\w+) with \L\u$1 \uCrUeL \E\u$2 in HeLlO wOrLd yields Hello Cruel WOrLd nononononononononono3.7–3.10 errornonoall
default
nonoerror
Case Conversion \U\l The first character after \U\l that is inserted into the replacement text as a literal or by a token is converted to lowercase and the following characters up to the next \E or \L are converted to uppercase. Replacing (\w+) (\w+) with \U\l$1 \lCrUeL \E\l$2 in HeLlO WoRlD yields hELLO cRUEL woRlD nononononononononono3.7–3.10 errornonoall
default
nonoerror
FeatureSyntaxDescriptionExample.NET Java Perl PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE Oracle XPath
©2015-2025 艾丽卡 support@alaica.com