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

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容
发表 admin at 2024年3月5日
类别
  • 正则表达式
标签
比对内容
  • 简
  • 繁
  • En
关于正则表达式 » 替换字符串教程 » 比对内容

替换文本教学
简介
字符
不可打印字符
比对文本
反向引用
比对内容
大小写转换
条件式
本网站更多信息
简介
正则表达式快速入门
正则表达式教程
替换字符串教程
应用程序和语言
正则表达式范例
正则表达式参考
替换字符串参考

比对内容

有些应用程序支持替换字符串中的特殊符号,让您可以在正则表达式比对前后插入主旨字符串或主旨字符串的一部分。当替换文本语法用于收集搜索比对及其内容,而不是在主旨字符串中进行替换时,这会很有用。

在替换文本中,$<(美元符号反引号)会替换为正则表达式比对左侧的主旨字符串部分,在 Delphi、.NET、JavaScript、VBScript、Boost 和 std::regex 中。它也是变量,用于保存正则表达式比对左侧的主旨字符串部分,在 Perl 中。\<(反斜线反引号)在 Delphi 和 Ruby 中有效。

在相同的应用程序中,您可以使用 $'(美元符号单引号)或 \'(反斜线单引号)插入正则表达式比对右侧的主旨字符串部分。

在替换文本中,$_ 会替换为 Delphi 和 .NET 中的完整主旨字符串。在 Perl 中,$_ 是正则表达式套用的缺省变量,如果您使用正则表达式而没有比对操作符 =~。 \_ 仅为 转义 的底线。在任何应用程序中都没有特殊意义。

Boost 1.42 添加了一些它自己发明的替代语法。 $PREMATCH 和 ${^PREMATCH} 是 $` 的同义词。 $POSTMATCH 和 ${^POSTMATCH} 是 $' 的同义词。

比對內容
  • 简
  • 繁
  • En
關於正規表示式 » 替換字串教學 » 比對內容

替換文字教學
簡介
字元
不可列印字元
比對文字
反向參照
比對內容
大小寫轉換
條件式
本網站更多資訊
簡介
正規表示式快速入門
正規表示式教學
替換字串教學
應用程式和語言
正規表示式範例
正規表示式參考
替換字串參考

比對內容

有些應用程式支援替換字串中的特殊符號,讓您可以在正規表示式比對前後插入主旨字串或主旨字串的一部分。當替換文字語法用於收集搜尋比對及其內容,而不是在主旨字串中進行替換時,這會很有用。

在替換文字中,$<(美元符號反引號)會替換為正規表示式比對左側的主旨字串部分,在 Delphi、.NET、JavaScript、VBScript、Boost 和 std::regex 中。它也是變數,用於儲存正規表示式比對左側的主旨字串部分,在 Perl 中。\<(反斜線反引號)在 Delphi 和 Ruby 中有效。

在相同的應用程式中,您可以使用 $'(美元符號單引號)或 \'(反斜線單引號)插入正規表示式比對右側的主旨字串部分。

在替換文字中,$_ 會替換為 Delphi 和 .NET 中的完整主旨字串。在 Perl 中,$_ 是正規表示式套用的預設變數,如果您使用正規表示式而沒有比對運算子 =~。 \_ 僅為 跳脫 的底線。在任何應用程式中都沒有特殊意義。

Boost 1.42 新增了一些它自己發明的替代語法。 $PREMATCH 和 ${^PREMATCH} 是 $` 的同義詞。 $POSTMATCH 和 ${^POSTMATCH} 是 $' 的同義詞。

Match Context
  • 简
  • 繁
  • En
About Regular Expressions » Replacement Strings Tutorial » Match Context

Replacement Text Tutorial
Introduction
Characters
Non-Printable Characters
Matched Text
Backreferences
Match 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

Match Context

Some applications support special tokens in replacement strings that allow you to insert the subject string or the part of the subject string before or after the regex match. This can be useful when the replacement text syntax is used to collect search matches and their context instead of making replacements in the subject string.

In the replacement text, $` (dollar backtick) is substituted with the part of the subject string to the left of the regex match in Delphi, .NET, JavaScript, VBScript, Boost, and std::regex. It is also the variable that holds the part of the subject string to the left of the regex match in Perl. \` (backslash backtick) works in Delphi, and Ruby.

In the same applications, you can use $' (dollar quote) or \' (backslash quote) to insert the part of the subject string to the right of the regex match.

In the replacement text, $_ is substituted with the entire subject string in Delphi, and .NET. In Perl, $_ is the default variable that the regex is applied to if you use a regular expression without the matching operator =~. \_ is just an escaped underscore. It has no special meaning in any application.

Boost 1.42 added some alternative syntax of its own invention. $PREMATCH and ${^PREMATCH} are synonyms for $`. $POSTMATCH and ${^POSTMATCH} are synonyms for $'.

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