REReplace

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.

Syntax

REReplace(string, reg_expression, substring [, scope ])
string

Any string.

reg_expression

Regular expression to be replaced. This regular expression can include POSIX-specified character classes (for example, [:alpha:], [:digit:], [:upper:], and [:lower:]).

substring

String replacing reg_expression.

scope

Defines how to complete the replace operation:

Examples

<!--- 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>