View comments | RSS feed

REReplaceNoCase

Description

Uses a regular expression to search a string for a string pattern and replace it with another. The search is case-insensitive.

Return value

Category

String functions

Syntax

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

See also

REFind, REFindNoCase, Replace, ReplaceList

History

New in ColdFusion MX: this function inserts the following special characters in regular expression replacement strings, to control case conversion: \u, \U, \l, \L, and \E. If any of these strings is present in a ColdFusion 5 application, you must insert a backslash before it (for example, change "\u" to "\\u").

Parameters

Parameter Description
string
A string or a variable that contains one.
reg_expression
Regular expression to replace. For more information, see Developing ColdFusion MX Applications with CFML.
substring
A string or a variable that contains one. Replaces reg_expression.
scope
  • one: Replace the first occurrence of the regular expression. Default.
  • all: Replace all occurrences of the regular expression.

Usage

To include a backslash character in a parameter of this function, you must precede it with another backslash, as an escape character.

Example

<p>The REReplaceNoCase function returns <i>string</i> with a regular 
expression replaced with <i>substring</i> in the specified scope. 
This is a case-insensitive search.
<p>REReplaceNoCase("cabaret","C|B","G","ALL"):  
<cfoutput>#REReplaceNoCase("cabaret","C|B","G","ALL")#</cfoutput>
<p>REReplaceNoCase("cabaret","[A-Z]","G","ALL"):  
<cfoutput>#REReplaceNoCase("cabaret","[A-Z]","G","ALL")#</cfoutput>
<p>REReplaceNoCase("I LOVE JELLIES","jell(y|ies)","cookies"):  
<cfoutput>#REReplaceNoCase("I LOVE JELLIES","jell(y|ies)","cookies")#
</cfoutput>
<p>REReplaceNoCase("I LOVE JELLY","jell(y|ies)","cookies"):  
<cfoutput>#REReplaceNoCase("I LOVE JELLY","jell(y|ies)","cookies")#
</cfoutput>

ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6

Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.

Comments


narsavagep said on May 13, 2004 at 1:08 PM :
You need a link to the definition of a "regular expression" -- how to use it and the special characters to use.
narsavagep said on May 13, 2004 at 1:15 PM :
FYI: The link is http://livedocs.macromedia.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/regexp3.htm#1117230

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt270.htm