Returns string with a regular expression being replaced with substring in the specified scope. This is a case-sensitive search.
See also REFind, Replace, ReplaceList, and REReplaceNoCase.
REReplace(string, reg_expression, substring [, scope ])
Any string.
Regular expression to be replaced. This regular expression can include POSIX-specified character classes (for example, [:alpha:], [:digit:], [:upper:], and [:lower:]).
String replacing reg_expression.
Defines how to complete the replace operation:
ONE -- Replace only the first occurrence (default).ALL -- Replace all occurrences.<!--- This example shows the use of REReplace --->
<HTML>
<HEAD>
<TITLE>
REReplace Example
</TITLE>
</HEAD>
<BODY bgcolor=silver>
<H3>REReplace Example</H3>
<P>The REReplace function returns <i>string</i> with a regular expression
being replaced with <i>substring</i> in the specified scope.
This is a case-sensitive search.
<P>REReplace("CABARET","C|B","G","ALL"):
<CFOUTPUT>#REReplace("CABARET","C|B","G","ALL")#</CFOUTPUT>
<P>REReplace("CABARET","[A-Z]","G","ALL"):
<CFOUTPUT>#REReplace("CABARET","[A-Z]","G","ALL")#</CFOUTPUT>
<P>REReplace("I love jellies","jell(y|ies)","cookies"):
<CFOUTPUT>#REReplace("I love jellies","jell(y|ies)","cookies")#
</CFOUTPUT>
<P>REReplace("I love jelly","jell(y|ies)","cookies"):
<CFOUTPUT>#REReplace("I love jelly","jell(y|ies)","cookies")#</CFOUTPUT>
</BODY>
</HTML>