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.

See the following sections for details on using regular expressions in ColdFusion:



Banner.Novgorod.Ru