Limiting Input String Size; Anchoring A Regular Expression To A String - MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual

Table of Contents

Advertisement

264
An excellent reference on regular expressions is Mastering Regular Expressions,
Jeffrey E. F. Friedl. O'Reilly & Associates, Inc., 1997. ISBN: 1-56592-257-3, http://
www.oreilly.com.

Limiting input string size

In CFML regular expression functions, large input strings (greater than
approximately 20,000 characters) cause a debug assertion failure and a regular
expression error occurs. To avoid this, break your input into smaller chunks, as the
following example shows. Here the variable input has a size greater than 50000.
<cfset test = mid(input, 1, 20000)>
<cfset out1 = REReplace(test, "[
<cfset test = mid(input, 20001, 20000)>
<cfset out2 = REReplace(test, "[
<cfset test = mid(input, 40001, len(input) - 40000)>
<cfset out3 = REReplace(test, "[
<cfset result = out1 & out2 & out3>

Anchoring a regular expression to a string

You can anchor all or part of a regular expression to either the beginning or end of
the string being searched:
#Chr(9)##Chr(13)##Chr(10)#]+#Chr(13)##Chr(10)#", "#chr(10)#",
"ALL")>
#Chr(9)##Chr(13)##Chr(10)#]+#Chr(13)##Chr(10)#", "#chr(10)#",
"ALL")>
#Chr(9)##Chr(13)##Chr(10)#]+#Chr(13)##Chr(10)#", "#chr(10)#",
"ALL")>
If the caret (^) is at the beginning of a (sub)expression, the matched string must
be at the beginning of the string being searched.
If the dollar sign ($) is at the end of a (sub)expression, the matched string must be
at the end of the string being searched.
Chapter 14 Using Regular Expressions in Functions

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 5

Table of Contents