<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>REPLACE</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">REPLACE</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>
Replaces occurrences of substring1 in a string with substring2, in a specified scope. 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>
The string, after making replacements. 
</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>Replace(string, substring1, substring2 [, 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>
Find, REFind, ReplaceNoCase, ReplaceList, REReplace
</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>
To remove a string, specify the empty string (&quot;&quot;) as substring2.
</p>

<p>
You do not need to escape comma characters in strings. For example, the following code deletes the commas from the sentence:
</p>
<pre>replace(&quot;The quick brown fox jumped over the lazy cow, dog, and 
cat.&quot;,&quot;,&quot;,&quot;&quot;,&quot;All&quot;)
</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">Example</span><pre>&lt;h3&gt;Replace Example&lt;/h3&gt;

&lt;p&gt;The Replace function returns &lt;I&gt;string&lt;/I&gt; with &lt;I&gt;substring1&lt;/I&gt; 
replaced by &lt;I&gt;substring2&lt;/I&gt; in the specified scope. This 
is a case-sensitive search.

&lt;cfif IsDefined(&quot;FORM.MyString&quot;)&gt;
&lt;p&gt;Your original string, &lt;cfoutput&gt;#FORM.MyString#&lt;/cfoutput&gt;
&lt;p&gt;You wanted to replace the substring &lt;cfoutput&gt;#FORM.MySubstring1#
&lt;/cfoutput&gt;
with the substring &lt;cfoutput&gt;#FORM.MySubstring2#&lt;/cfoutput&gt;.
&lt;p&gt;The result: &lt;cfoutput&gt;#Replace(FORM.myString, 
FORM.MySubstring1, FORM.mySubString2)#&lt;/cfoutput&gt;
&lt;/cfif&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 in which to search. </p>

  </td>
  </tr>
  </table>
</div>
<div id="SUBSTRING1">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">SUBSTRING1</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 for which to search </p>

  </td>
  </tr>
  </table>
</div>
<div id="SUBSTRING2">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">SUBSTRING2</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>String that replaces substring1</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>
