<doc>
  <legacy_id>2523</legacy_id>
  <name>replace</name>
  <type>command</type>
  <syntax>
    <example>replace <i>oldString</i> with <i>newString</i> in <i>container </i></example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Text and Data Processing</category>
  </classification>
  <references>
    <command tag="find">find Command</command>
    <command tag="filter">filter Command</command>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
  </security>
  <summary>Replaces text in a <glossary tag="container">container</glossary> with other text.</summary>
  <examples>
    <example>replace "A" with "N" in thisVariable <i>-- changes all As to Ns</i></example>
    <example>replace return with empty in field 1 <i>-- runs lines together</i></example>
    <example>replace somethingOld with "\" in it</example>
    <example>replace ".com" with somethingNew in URL "file:stuff.txt"</example>
  </examples>
  <description>
    <p>Use the <b>replace</b> <glossary tag="command">command</glossary> to replace all instances of one <keyword tag="string">string</keyword> with another <keyword tag="string">string</keyword>.</p><p/><p><b>Parameters:</b></p><p>The <i>oldString</i> is any <glossary tag="expression">expression</glossary> that <glossary tag="evaluate">evaluates</glossary> to a <keyword tag="string">string</keyword>, and specifies the text to replace.</p><p/><p>The <i>newString</i> is any <glossary tag="expression">expression</glossary> that <glossary tag="evaluate">evaluates</glossary> to a <keyword tag="string">string</keyword>, and specifies the text to replace the <i>oldString</i> with.</p><p/><p>The <i>container</i> is a <keyword tag="field">field</keyword>, <keyword tag="button">button</keyword>, or <glossary tag="variable">variable</glossary>, or the <keyword tag="message box">message box</keyword>.</p><p/><p><b>Comments:</b></p><p>The <b>replace</b> <glossary tag="command">command</glossary> is faster than the <function tag="replaceText">replaceText</function> <control_st tag="function">function</control_st>, but does not support <glossary tag="regular expression">regular expressions</glossary>: you can replace only an exact <keyword tag="string">string</keyword> of text.</p><p/><p><code/><img src="202653"/> <b>Important!</b><code/> You can use the <command tag="replace">replace</command> <glossary tag="command">command</glossary> on a <keyword tag="field">field</keyword>, but doing so removes any formatting (fonts, styles, colors, and sizes) in the field. To work around this limitation, use the <glossary tag="field">field's</glossary> <property tag="HTMLText">htmlText</property> property as the source for replacement instead of using the <keyword tag="field">field</keyword> itself as the source:</p><p/><p><code>  get the htmlText of field "Stuff"</code></p><p><code>  replace "old" with "new" in it</code></p><p><code>  set the htmlText of field "Stuff" to it</code></p>
  </description>
</doc>