Contents > Developing ColdFusion MX Applications > Using Regular Expressions in Functions > Regular expression examples > Regular expressions in CFML PreviousNext

Regular expressions in CFML

The following examples of CFML show some common uses of regular expression functions:

Expression

Returns

REReplace (CGI.Query_String, "CFID=[0-9]+[&]*", "")

The query string with parameter CFID and its numeric value stripped out.

REReplace("I Love Jellies", "[[:lower:]]","x","ALL"

I Lxxx Jxxxxxx

REReplaceNoCase("cabaret","[A-Z]", "G","ALL")

GGGGGGG

REReplace (Report,"\$[0-9,]*\.[0-9]*",
"$***.**")", "")

The string value of the variable Report with all positive numbers in the dollar format changed to "$***.**".

REFind ("[Uu]\.?[Ss]\.?[Aa}\.?", Report )

The position in the variable Report of the first occurrence of the abbreviation USA. The letters can be in either case and the abbreviation can have a period after any letter.

REFindNoCase("a+c","ABCAACCDD")

4

REReplace("There is is coffee in the the kitchen",
"([A-Za-z]+)[ ]+\1","*","ALL")

There * coffee in * kitchen

REReplace(report, "<[^>]*>", "", "All")

Removes all HTML tags from a string value of the report variable.


Contents > Developing ColdFusion MX Applications > Using Regular Expressions in Functions > Regular expression examples > Regular expressions in CFML PreviousNext

ColdFusion 9 | 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.

 

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

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