rEReplaceNoCase
Description
Uses a regular expression to search a string for a string pattern and replace it with another. The search is case-insensitive.
Categories
Related
History
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, insert a backslash before it (for example, change
"\u" to "\\u").
Syntax
REReplaceNoCase(string, reg_expression, substring [, scope ])
Attributes
| Attribute | Description | Required | Default |
|---|---|---|---|
| reg_expression | Regular expression to replace. For more information, see Using Regular Expressions in Functions in the Developing ColdFusion Applications. | ||
| scope | one: replaces the first occurrence of the regular expression. Default. all: replaces all occurrences of the regular expression. | ||
| string | A string or a variable that contains one. | ||
| substring | A string or a variable that contains one. Replaces reg_expression. |
Usage
For details on using regular expressions, see Using Regular Expressions in Functions in the Developing ColdFusion Applications.
Example
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.
REReplaceNoCase("cabaret","C|B","G","ALL"):
<cfoutput>#REReplaceNoCase("cabaret","C|B","G","ALL")#</cfoutput>
REReplaceNoCase("cabaret","[A-Z]","G","ALL"):
<cfoutput>#REReplaceNoCase("cabaret","[A-Z]","G","ALL")#</cfoutput>
REReplaceNoCase("I LOVE JELLIES","jell(y|ies)","cookies"):
<cfoutput>#REReplaceNoCase("I LOVE JELLIES","jell(y|ies)","cookies")#
</cfoutput>
REReplaceNoCase("I LOVE JELLY","jell(y|ies)","cookies"):
<cfoutput>#REReplaceNoCase("I LOVE JELLY","jell(y|ies)","cookies")#
</cfoutput>