View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > REReplaceNoCase PreviousNext

REReplaceNoCase

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

String functions

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

REFind, REFindNoCase, Replace, ReplaceList

ColdFusion MX: Changed behavior: 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").

Parameter

Description

string

A string or a variable that contains one.

reg_expression

Regular expression to replace. For more information, see Using Regular Expressions in Functions in Developing ColdFusion MX Applications.

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.

For details on using regular expressions, see Using Regular Expressions in Functions in Developing ColdFusion MX Applications.

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

Contents > CFML Reference > ColdFusion Functions > REReplaceNoCase PreviousNext

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

Version 6.1

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

Comments


Kamstar said on Feb 7, 2005 at 4:12 PM :
It isn't immediately obvious that you can use backreferences in the substring to replace as well, e.g. REReplaceNoCase( "hello goodbye", "(hello)", " ", "all" )

It's certainly nice though.

 

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

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functa72.htm