Regular Expressions In Cfml; Types Of Regular Expression Technologies - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

Expression
(\+|-)?[1-9]\.[0-9]*E(\+|-)?[0-9]+
a{2,4}
(ba){3,}

Regular expressions in CFML

The following examples of CFML show some common uses of regular expression functions:
Expression
REReplace (CGI.Query_String, "CFID=[0-9]+[&]*",
"")
REReplace("I Love Jellies",
"[[:lower:]]","x","ALL"
REReplaceNoCase("cabaret","[A-Z]", "G","ALL")
REReplace (Report,"\$[0-9,]*\.[0-9]*",
"$***.**")", "")
REFind ("[Uu]\.?[Ss]\.?[Aa}\.?", Report )
REFindNoCase("a+c","ABCAACCDD")
REReplace("There is is coffee in the the kitchen",
"([A-Za-z]+)[ ]+\1","*","ALL")
REReplace(report, "<[^>]*>", "", "All")

Types of regular expression technologies

Many types of regular expression technologies are available to programmers. JavaScript, Perl, and
POSIX are all examples of different regular expression technologies. Each technology has its own
syntax specifications and is not necessarily compatible with other technologies.
ColdFusion supports regular expressions that are Perl compliant with a few exceptions:
A period, ., always matches newlines.
In replacement strings, use \n instead of $n for backreference variables. ColdFusion escapes all
$ in the replacement string.
You do not have to escape backslashes in replacement strings. ColdFusion escapes them, with
the exception of case conversion sequences or escaped versions (e.g. \u or \\u).
Embedded modifiers ( (?i), etc. ) always affect the entire expression, even if they are inside a
group.
\Q and the combinations \u\L and \l\U are not supported in replacement strings.
Description
A real number in engineering notation.
Two to four occurrences of "a": aa, aaa, aaaa.
At least three "ba" pairs: bababa, babababa, and so on.
Returns
The query string with parameter CFID
and its numeric value stripped out.
I Lxxx Jxxxxxx
GGGGGGG
The string value of the variable Report
with all positive numbers in the dollar
format changed to "$***.**".
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.
4
There * coffee in * kitchen
Removes all HTML tags from a string
value of the report variable.

Types of regular expression technologies

159

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion mx

Table of Contents