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&nbsp;Start</div></a><a href="tutorial.html" target="_top"><div>Tutorial</div></a><a href="tools.html" target="_top"><div>Tools&nbsp;&amp;&nbsp;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&nbsp;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 &amp; Backreferences</A></TD></TR><TR><TD><A HREF="refreplacecase.html" TARGET=_top>Context &amp; 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 &amp; 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>|&ensp;<a href='quickstart.html'>Quick&nbsp;Start</a>&ensp;|&ensp;<a href='tutorial.html'>Tutorial</a>&ensp;|&ensp;<a href='tools.html'>Tools&nbsp;&amp;&nbsp;Languages</a>&ensp;|&ensp;<a href='examples.html'>Examples</a>&ensp;|&ensp;<a href='refflavors.html'>Reference</a>&ensp;|&ensp;<a href='books.html'>Book&nbsp;Reviews</a>&ensp;|</p><p>|&ensp;<a href='reference.html'>Introduction</a>&ensp;|&ensp;<a href='refreplace.html'>Table of Contents</a>&ensp;|&ensp;<a href='refreplacecharacters.html'>Characters</a>&ensp;|&ensp;<a href='refreplacebackref.html'>Matched Text &amp; Backreferences</a>&ensp;|&ensp;<a href='refreplacecase.html'>Context &amp; Case Conversion</a>&ensp;|&ensp;<a href='refreplaceconditional.html'>Conditionals</a>&ensp;|&ensp;<a href='refflavors.html'>Regular Expressions Reference</a>&ensp;|</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 &copy; 2003-2024 Jan Goyvaerts. All rights reserved.</P> </div> </div> </div> </body></html>

Pages: 1 2 3 4 5 6 7 8 9 10