![MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual Download Page 284](http://html1.mh-extra.com/html/macromedia/coldfusion-5-developing/coldfusion-5-developing_develop-manual_3293641284.webp)
264
Chapter 14 Using Regular Expressions in Functions
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, "[
#Chr(9)##Chr(13)##Chr(10)#]+#Chr(13)##Chr(10)#", "#chr(10)#",
"ALL")>
<cfset test = mid(input, 20001, 20000)>
<cfset out2 = REReplace(test, "[
#Chr(9)##Chr(13)##Chr(10)#]+#Chr(13)##Chr(10)#", "#chr(10)#",
"ALL")>
<cfset test = mid(input, 40001, len(input) - 40000)>
<cfset out3 = REReplace(test, "[
#Chr(9)##Chr(13)##Chr(10)#]+#Chr(13)##Chr(10)#", "#chr(10)#",
"ALL")>
<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:
•
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.
Summary of Contents for COLDFUSION 5-DEVELOPING
Page 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Page 58: ...38 Chapter 3 Querying a Database ...
Page 134: ...114 Chapter 7 Updating Your Database ...
Page 210: ...190 Chapter 10 Reusing Code ...
Page 232: ...212 Chapter 11 Preventing and Handling Errors ...
Page 238: ...218 Chapter 12 Using the Application Framework ...
Page 262: ...242 Chapter 12 Using the Application Framework ...
Page 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Page 320: ...300 Chapter 15 Indexing and Searching Data ...
Page 336: ...316 Chapter 16 Sending and Receiving E mail ...
Page 374: ...354 Chapter 18 Interacting with Remote Servers ...