Name

REFindNoCase

Synopsis

REFindNoCase(regex, string [, startpos] [, returnsubexpressions])

Returns the position of the first occurrence of regex in string. regex can be any valid ColdFusion regular expression. An optional starting position for the search can be specified by startpos. If returnsubexpressions is set to True (False is the default), REFindNoCase( ) returns a CFML structure containing two keys, pos and len, that represent the position and length, respectively, of the matched regular expression. If REFindNoCase( ) is unable to find a match for the regular expression, 0 is returned. REFindNoCase( ) performs a case-insensitive search. Here’s an example that demonstrates the use of the REFindNoCase( ) function with the returnsubexpressions parameter set to True:

<CFSET MyString="The name of the bank robber is Rob.">
<CFSET matches= ReFindNoCase("Rob", MyString, 1, "TRUE")>

<CFOUTPUT>
<B>String:</B>  #MyString#<BR>
<B>Regex:</B>  RefindNoCase(&quot;cat&quot;, MyString, 1, &quot;TRUE&quot;)<BR>
<B>Position:</B> #matches.pos[1]#<BR>
<B>Length:</B> #matches.len[1]#
</CFOUTPUT>

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.