260
Chapter 14 Using Regular Expressions in Functions
About Regular Expressions
Regular expressions allow you to perform very powerful and flexible string search
and replace operations. In traditional search and replace operations, as in the
Find
and
Replace
functions of ColdFusion, you must provide the exact text to be searched
for. This makes searches for dynamic data very difficult, if not impossible. For
example, how can you find the first occurrence in a string of any word that consists
entirely of capital letters that has spaces around it? Using regular expressions, the
task is trivial:
<cfset IndexOfOccurrence=REFind(" [A-Z]+ ","Some BIG string")>
<!--- The value of IndexOfOccurrence is 5 --->
You often process large amounts of dynamic textual data. Regular expressions can be
invaluable in writing complex ColdFusion applications.
You can use the case-insensitive functions,
REFindNoCase
and
REReplaceNoCase
, for
expressions where the search string is likely to be mixed case.
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 ...