<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>REREPLACE</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="Description">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">REREPLACE</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Description</span>
<p>
Uses a regular expression (RE) to search a string for a string pattern and replace it with another. The search is case-sensitive.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Returns</span>
<p>
If the scope parameter is set to one, returns a string with the first occurrence of the regular expression replaced by the value of substring.
</p>

<p>
If the scope parameter is set to all, returns a string with all occurrences of the regular expression replaced by the value of substring. 
</p>

<p>
If the function finds no matches, it returns a copy of the string unchanged. 
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Category</span>
<p>
String functions
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Function syntax</span><pre>REReplace(string, reg_expression, substring [, scope ])
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">See also</span>
<p>
REFind, Replace, ReplaceList, REReplaceNoCase
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">History</span>
<p>
ColdFusion&#160;MX: Added supports for the following special codes in a replacement substring, to control case conversion: 
</p>
<ul>

<li>\u - uppercase the next character</li>

<li>\l - lowercase the next character</li>

<li>\U - uppercase until \E </li>

<li>\L - lowercase until \E </li>

<li>\E - end \U or \L</li>
</ul>

<p>
For more information on new features, see REFind.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Parameters</span>
<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Usage</span>
<p>
For details on using regular expressions, see Chapter&#160;7, "Using Regular Expressions in Functions," in ColdFusion MX Developer's Guide.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Example</span><pre>&lt;p&gt;The REReplace function returns &lt;i&gt;string&lt;/i&gt; with a regular expression 
replaced
with &lt;i&gt;substring&lt;/i&gt; in the specified scope. Case-sensitive search.
&lt;p&gt;REReplace(&quot;CABARET&quot;,&quot;C|B&quot;,&quot;G&quot;,&quot;ALL&quot;):   
&lt;cfoutput&gt;#REReplace(&quot;CABARET&quot;,&quot;C|B&quot;,&quot;G&quot;,&quot;ALL&quot;)#&lt;/cfoutput&gt;
&lt;p&gt;REReplace(&quot;CABARET&quot;,&quot;[A-Z]&quot;,&quot;G&quot;,&quot;ALL&quot;):   
&lt;cfoutput&gt;#REReplace(&quot;CABARET&quot;,&quot;[A-Z]&quot;,&quot;G&quot;,&quot;ALL&quot;)#&lt;/cfoutput&gt;
&lt;p&gt;REReplace(&quot;I love jellies&quot;,&quot;jell(y|ies)&quot;,&quot;cookies&quot;):
&lt;cfoutput&gt;#REReplace(&quot;I love jellies&quot;,&quot;jell(y|ies)&quot;,&quot;cookies&quot;)#
 &lt;/cfoutput&gt;
&lt;p&gt;REReplace(&quot;I love jelly&quot;,&quot;jell(y|ies)&quot;,&quot;cookies&quot;):
&lt;cfoutput&gt;#REReplace(&quot;I love jelly&quot;,&quot;jell(y|ies)&quot;,&quot;cookies&quot;)#&lt;/cfoutput&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="STRING">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">STRING</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>A string or a variable that contains one. String within which to search. </p>

  </td>
  </tr>
  </table>
</div>
<div id="REG_EXPRESSION">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">REG_EXPRESSION</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>Regular expression to replace. The search is case-sensitive. </p>

  </td>
  </tr>
  </table>
</div>
<div id="SUBSTRING">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">SUBSTRING</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>A string or a variable that contains one. Replaces reg_expression.</p>

  </td>
  </tr>
  </table>
</div>
<div id="SCOPE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">SCOPE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

<ul>

<li>one: replaces the first occurrence (default).</li>

<li>all: replaces all occurrences.</li>
</ul>


  </td>
  </tr>
  </table>
</div>

  </body>
</html>
