Multicharacter Regular Expressions

You can use the following rules to build multicharacter regular expressions:

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:



Banner.Novgorod.Ru