CINXE.COM
Replacement Strings Reference Table of Contents
<!DOCTYPE html> <html lang="en"><head><meta charset="utf-8"><link rel=canonical href='https://https://www.regular-expressions.info//refreplace.html'><title>Replacement Strings Reference Table of Contents</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="author" content="Jan Goyvaerts"> <meta name="description" content="Compare the replacement text syntax and features supported by all the major regular expression flavors, including .NET, Java, Perl, PCRE, JavaScript, Python, Ruby, POSIX, etc."> <meta name="keywords" content=""> <link rel=stylesheet href="regex.css" type="text/css"><script src="theme.js" type="text/javascript"></script><link rel="alternate" type="application/rss+xml" title="New at Regular-Expressions.info" href="updates.xml"> </head> <body bgcolor=white text=black> <div id=top></div> <div id=btntop><div id=btngrid><a href="quickstart.html" target="_top"><div>Quick Start</div></a><a href="tutorial.html" target="_top"><div>Tutorial</div></a><a href="tools.html" target="_top"><div>Tools & Languages</div></a><a href="examples.html" target="_top"><div>Examples</div></a><a href="refflavors.html" target="_top"><div>Reference</div></a><a href="books.html" target="_top"><div>Book Reviews</div></a></div></div> <div id=contents><div id=side> <TABLE CLASS=side CELLSPACING=0 CELLPADDING=4><TR><TD CLASS=sideheader>Replacement Reference</TD></TR><TR><TD><A HREF="reference.html" TARGET=_top>Introduction</A></TD></TR><TR><TD><A HREF="refreplace.html" TARGET=_top>Table of Contents</A></TD></TR><TR><TD><A HREF="refreplacecharacters.html" TARGET=_top>Characters</A></TD></TR><TR><TD><A HREF="refreplacebackref.html" TARGET=_top>Matched Text & Backreferences</A></TD></TR><TR><TD><A HREF="refreplacecase.html" TARGET=_top>Context & Case Conversion</A></TD></TR><TR><TD><A HREF="refreplaceconditional.html" TARGET=_top>Conditionals</A></TD></TR><TR><TD><A HREF="refflavors.html" TARGET=_top>Regular Expressions Reference</A></TD></TR> </TABLE><TABLE CLASS=side CELLSPACING=0 CELLPADDING=4><TR><TD CLASS=sideheader>More on This Site</TD></TR><TR><TD><A HREF="index.html" TARGET=_top>Introduction</A></TD></TR><TR><TD><A HREF="quickstart.html" TARGET=_top>Regular Expressions Quick Start</A></TD></TR><TR><TD><A HREF="tutorial.html" TARGET=_top>Regular Expressions Tutorial</A></TD></TR><TR><TD><A HREF="replacetutorial.html" TARGET=_top>Replacement Strings Tutorial</A></TD></TR><TR><TD><A HREF="tools.html" TARGET=_top>Applications and Languages</A></TD></TR><TR><TD><A HREF="examples.html" TARGET=_top>Regular Expressions Examples</A></TD></TR><TR><TD><A HREF="refflavors.html" TARGET=_top>Regular Expressions Reference</A></TD></TR><TR><TD><A HREF="refreplace.html" TARGET=_top>Replacement Strings Reference</A></TD></TR><TR><TD><A HREF="books.html" TARGET=_top>Book Reviews</A></TD></TR><TR><TD><A HREF="print.html" TARGET=_top>Printable PDF</A></TD></TR><TR><TD><A HREF="about.html" TARGET=_top>About This Site</A></TD></TR><TR><TD><A HREF="updates.html" TARGET=_top>RSS Feed & Blog</A></TD></TR></TABLE></DIV><div class=bodytext><div class=topad style="height:130px"><A HREF="https://www.regexbuddy.com/benefits.html" TARGET="_top"><picture><source media="(max-width: 370px)" srcset="ads/320/rxbrefreplace100.png 1x, ads/320/rxbrefreplace150.png 1.5x, ads/320/rxbrefreplace200.png 2x, ads/320/rxbrefreplace250.png 2.5x, ads/320/rxbrefreplace300.png 3x, ads/320/rxbrefreplace350.png 3.5x, ads/320/rxbrefreplace400.png 4x"><source media="(max-width: 500px)" srcset="ads/360/rxbrefreplace100.png 1x, ads/360/rxbrefreplace150.png 1.5x, ads/360/rxbrefreplace200.png 2x, ads/360/rxbrefreplace250.png 2.5x, ads/360/rxbrefreplace300.png 3x, ads/360/rxbrefreplace350.png 3.5x, ads/360/rxbrefreplace400.png 4x"><source media="(max-width: 660px)" srcset="ads/480/rxbrefreplace100.png 1x, ads/480/rxbrefreplace150.png 1.5x, ads/480/rxbrefreplace200.png 2x, ads/480/rxbrefreplace250.png 2.5x, ads/480/rxbrefreplace300.png 3x, ads/480/rxbrefreplace350.png 3.5x, ads/480/rxbrefreplace400.png 4x"><source media="(max-width: 747px)" srcset="ads/640/rxbrefreplace100.png 1x, ads/640/rxbrefreplace150.png 1.5x, ads/640/rxbrefreplace200.png 2x, ads/640/rxbrefreplace250.png 2.5x, ads/640/rxbrefreplace300.png 3x, ads/640/rxbrefreplace350.png 3.5x, ads/640/rxbrefreplace400.png 4x"><img src="ads/728/rxbrefreplace100.png" srcset="ads/728/rxbrefreplace100.png 1x, ads/728/rxbrefreplace125.png 1.25x, ads/728/rxbrefreplace150.png 1.5x, ads/728/rxbrefreplace175.png 1.75x, ads/728/rxbrefreplace200.png 2x, ads/728/rxbrefreplace250.png 2.5x, ads/728/rxbrefreplace300.png 3x, ads/728/rxbrefreplace350.png 3.5x, ads/728/rxbrefreplace400.png 4x" alt="RegexBuddy鈥擝etter than a regular expression reference!"></picture></A></div> <div class=bulb><h1>Replacement Strings Reference Table of Contents</h1><script type="text/javascript">showbulb();</script></div> <p><A HREF="reference.html" TARGET="_top">Introduction</A></p> <p class=indent>The introduction explains how to read the replacement strings reference tables.</p> <p><A HREF="refreplacecharacters.html" TARGET="_top">Literal Characters, Special Characters, and Non-Printable Characters</A></p> <p class=indent>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.</p> <p><A HREF="refreplacebackref.html" TARGET="_top">Matched Text and Backreferences</A></p> <p class=indent>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 <A HREF="named.html" TARGET="_top">named</A> and <A HREF="brackets.html" TARGET="_top">numbered capturing groups</A> in the regular expression allow the replacement text to reuse parts of the text matched by the regular expression.</p> <p><A HREF="refreplacecase.html" TARGET="_top">Match Context and Case Conversion</A></p> <p class=indent>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.</p> <p class=indent>Some applications can insert the text matched by the regex or by capturing groups converted to uppercase or lowercase.</p> <p><A HREF="refreplaceconditional.html" TARGET="_top">Conditionals</A></p> <p class=indent>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.</p><div id=cntmobi><p>| <a href='quickstart.html'>Quick Start</a> | <a href='tutorial.html'>Tutorial</a> | <a href='tools.html'>Tools & Languages</a> | <a href='examples.html'>Examples</a> | <a href='refflavors.html'>Reference</a> | <a href='books.html'>Book Reviews</a> |</p><p>| <a href='reference.html'>Introduction</a> | <a href='refreplace.html'>Table of Contents</a> | <a href='refreplacecharacters.html'>Characters</a> | <a href='refreplacebackref.html'>Matched Text & Backreferences</a> | <a href='refreplacecase.html'>Context & Case Conversion</a> | <a href='refreplaceconditional.html'>Conditionals</a> | <a href='refflavors.html'>Regular Expressions Reference</a> |</p></div> <div id=copyright> <P CLASS=copyright>Page URL: <A HREF="https://www.regular-expressions.info/refreplace.html" TARGET="_top">https://www.regular-expressions.info/refreplace.html</A><BR> Page last updated: 29 August 2024<BR> Site last updated: 06 November 2024<BR> Copyright © 2003-2024 Jan Goyvaerts. All rights reserved.</P> </div> </div> </div> </body></html>