Sorcerer's IsleDocs cfRegexOverviewCode


This section describes the features which cfRegex provides. Unlike Actions which are called directly and do something, a feature is something which provides additional functionality across multiple actions, to change how an action works.

Another way of looking at it, features are things that work in addition to the regex engine functionality, and are applicable to more than one action.

Regex Functionality

The cfRegex project provides a number of features over the core CFML RE functions by means of simply using a newer regex engine. Since these are enhancements at the regex-level, they are documented in the general regex features section. They include:

(The remainder of the features discussed on this page are ones which cfRegex provides distinct from the regex engine used.)


A callback function lets you supply CFML logic that is executed each time a regex match is made, which provides a great deal of power and flexibility.

Callbacks can be used for the Match, Replace, and Split actions.

For full details on how callbacks work, see the dedicated Callbacks page.


In the core CFML RE functions, refind only matches once, rematch always matches everything, and rereplace can only replace once or everything, which results in far less efficient code when doing anything other than these things.

In cfRegex, all actions that have the ability to match multiple times will match as many times as possible, by default, and they all accept the Limit parameter which can be used to control how many times the action occurs.

Limit can be used with Find, Match, Replace, and Split actions.

See the Limit page for more information on how it works.


In the core CFML RE functions, refind lets you specify a starting character position which allows you to skip the first part of the input text. This is essential to allow for looping through multiple times (since refind can only match once per call).

With cfRegex, this start parameter has been extended so that all actions that have a limit parameter also accept the start parameter, to provide a convenient way to skip text that you do not want the regex pattern to see.

See the Start page for more information on how it works.