MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference page 519

Cfml language reference
Table of Contents

Advertisement

Chapter 2: ColdFusion Functions
495
length of the first instance of each subexpression within the regular expression are
returned in subsequent elements of the arrays.
Examples
<!--- This example shows the use of REFindNoCase --->
<HTML>
<HEAD>
<TITLE>
REFindNoCase Example
</TITLE>
</HEAD>
<BODY>
<H3>REFindNoCase Example</H3>
<P>This example demonstrates the use of the REFindNoCase function with
and without the <i>returnsubexpressions</i> parameter set to True.</P>
<P>If you do not use the <i>returnsubexpressions</i> parameter,
REFindNoCase returns the position of the first occurrence of a regular
expression in a string starting from the specified position.
Returns 0
if no occurrences are found.
</P>
<P>REFindNoCase("a+c+", "abcaaccdd"):
<CFOUTPUT>#REFindNoCase("a+c+", "abcaaccdd")#</CFOUTPUT></P>
<P>REFindNoCase("a+c*", "abcaaccdd"):
<CFOUTPUT>#REFindNoCase("a+c*", "abcaaccdd")#</CFOUTPUT></P>
<P>REFindNoCase("[[:alpha:]]+", "abcaacCDD"):
<CFOUTPUT>#REFindNoCase("[[:alpha:]]+", "abcaacCDD")#</CFOUTPUT></P>
<P>REFindNoCase("[\?&]rep=", "report.cfm?rep=1234&u=5"):
<CFOUTPUT>#REFindNoCase("[\?&]rep=", "report.cfm?rep=1234&u=5")#</
CFOUTPUT>
</P>
<!--- Set startPos to one; returnMatchedSubexpressions = TRUE --->
<hr size="2" color="#0000A0">
<P>If you do use the <i>returnssubexpression</i> parameter, REFindNoCase
returns the position and length of the first occurrence of a regular
expression in a string starting from the specified position. The position
and length variables are stored in a structure. In order to access the
position and length information, you must use the keys <i>pos</i> and
<i>len</i>, respectively.</P>
<CFSET teststring ="The cat in the hat hat came back!">
<P>The string in which the function is to search is:
<CFOUTPUT><b>#teststring#</b></CFOUTPUT>.</P>
<P>The first call to REFindNoCase to search this string is:
<b>REFindNoCase("[[:alpha:]]+",testString,1,"TRUE")</b></P>
<P>This function returns a structure that contains two arrays: pos and
len.</P>

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 4.5

Table of Contents