User Guide

494 CFML Language Reference
REFindNoCase
Returns the position of the first occurrence of a regular expression in a string starting
from the specified position if the returnsubexpressions parameter is not set to True.
Returns 0 if no occurrences are found.The search is case-insensitive.
Returns the position and length of the first occurrence of a regular expression in a
string if the returnsubexpressions parameter is set to True. See the description of the
returnsubexpressions parameter and the “Usage” section for details.
See also Find, FindNoCase, REReplace, and REReplaceNoCase.
Syntax REFindNoCase(
reg_expression
,
string
[,
start
]
[,
returnsubexpressions
] )
reg_expression
Regular expression used for search. This regular expression can include POSIX-
specified character classes (for example, [[:alpha:]], [[:digit:]], [[:upper:]], and
[[:lower:]]).
string
String being searched.
start
Optional. Starting position for the search. Default is 1.
returnsubexpressions
Optional. A Boolean value indicating whether a substring is returned. If you set
this parameter to TRUE, the function returns a CFML structure composed of two
single-element arrays containing the position and length of the first substring that
matches the criteria of the search. You can retrieve the position and length of the
matching subexpression by using the keys "pos" and "len." If there are no
occurrences of the regular expression, the "pos" and the "len" arrays each contain
one element that has a value of zero. If you set this parameter to FALSE, a scalar
value is returned indicating the position of the first occurrence of a regular
expression. The default value of this parameter is FALSE.
Usage In order to find multiple instances of a substring, you must call REFind more than
once, each time with a different starting position. To determine the next starting
position for the function, use the returnsubexpressions parameter and add the value
returned in the position key to the value in the length key.
If you do not use parentheses in the regular expression, the returnsubexpressions
parameter returns single element arrays that denote the position and length of the first
match found in the string.
If you do use parentheses to denote subexpressions within the regular expression, the
returnsubexpressions parameter returns the position and length of the first match of
the regular expression in the first element of the respective arrays; the position and