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

加载更多搜索结果...

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

替换参考
简介
目录
字符
配对文本和反向引用
内容和大小写转换
条件式
正则表达式参考
本网站其他信息
简介
正则表达式快速入门
正则表达式教学
替换字符串教程
应用程序和语言
正则表达式范例
正则表达式参考
替换字符串参考

替换字符串参考目录

简介

简介说明如何阅读替换字符串参考表格。

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

最简单的替换文本仅包含字面字符。某些字符在替换字符串中具有特殊含义,必须加上转义字符。在软件原代码中使用替换字符串时,转义规则可能会变得有点复杂。使用控制字符转义或十六进位转义,可以更轻松地输入不可打印字符,例如控制字符和特殊间距或换行字符。

配对文本和反向引用

将整个正则表达式配对重新插入替换文本中,让搜索和替换可以在正则表达式配对前后插入文本,而不用真正替换任何内容。反向引用 命名 和 编号捕获组 在正则表达式中,让替换文本可以重复使用正则表达式配对的文本部分。

配对内容和大小写转换

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

某些应用程序可以插入由正则表达式或捕获组配对的文本,并转换成大写或小写。

条件式

某些应用程序可以使用一个替换或另一个替换,具体取决于捕获组是否参与配对。这让您可以对正则表达式不同的配对使用不同的替换。

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

替換參考
簡介
目錄
字元
配對文字和反向參照
內容和大小寫轉換
條件式
正規表示法參考
本網站其他資訊
簡介
正規表示法快速入門
正規表示法教學
替換字串教學
應用程式和語言
正規表示法範例
正規表示法參考
替換字串參考

替換字串參考目錄

簡介

簡介說明如何閱讀替換字串參考表格。

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

最簡單的替換文字僅包含字面字元。某些字元在替換字串中具有特殊含義,必須加上跳脫字元。在軟體原始碼中使用替換字串時,跳脫規則可能會變得有點複雜。使用控制字元跳脫或十六進位跳脫,可以更輕鬆地輸入不可列印字元,例如控制字元和特殊間距或換行字元。

配對文字和反向參照

將整個正規表示法配對重新插入替換文字中,讓搜尋和替換可以在正規表示法配對前後插入文字,而不用真正替換任何內容。反向參照 命名 和 編號擷取群組 在正規表示法中,讓替換文字可以重複使用正規表示法配對的文字部分。

配對內容和大小寫轉換

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

某些應用程式可以插入由正規表示法或擷取群組配對的文字,並轉換成大寫或小寫。

條件式

某些應用程式可以使用一個替換或另一個替換,具體取決於擷取群組是否參與配對。這讓您可以對正規表示法不同的配對使用不同的替換。

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

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 Table of Contents

Introduction

The introduction explains how to read the replacement strings reference tables.

Literal Characters, Special Characters, and Non-Printable Characters

The simplest replacement text consists of only literal characters. Certain characters have special meanings in replacement strings and have to be escaped. Escaping rules may get a bit complicated when using replacement strings in software source code. Non-printable characters such as control characters and special spacing or line break characters are easier to enter using control character escapes or hexadecimal escapes.

Matched Text and Backreferences

Reinserting the entire regex match into the replacement text allows a search-and-replace to insert text before and after regular expression matches without really replacing anything. Backreferences to named and numbered capturing groups in the regular expression allow the replacement text to reuse parts of the text matched by the regular expression.

Match Context and Case Conversion

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.

Some applications can insert the text matched by the regex or by capturing groups converted to uppercase or lowercase.

Conditionals

Some applications can use one replacement or another replacement depending on whether a capturing group participated in the match. This allows you to use different replacements for different matches of the regular expression.

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