I have a character string, which is basically a tab delimited list. I need
a regular expression that will count the tabs in the string and verify they
are all there.
Essentially, I would like a regular expression that does this:
<cfset sOrderFile = "123 75 w1234567890 GRD 8/17/00 Sean Renet Broadcast
Dynamics 1230 MyStreet St. Los Angeles CA 90026 323-555-1212
[EMAIL PROTECTED] Amy Jones 1630 Your St. Apt. 2 Silverlake CA
90026 323-666-2137 323-555-4567 [EMAIL PROTECTED] Driver's liscence
C13546545 1234 I387409-0983 2 A Bit of the Bubbly Hi Sean, Here
is your champagne Hope you enjoy it! Amy Dane ">
<cfset nLength = #Len(sOrderFile)#>
<cfset nPosition = 0> <!--- Position of tab in string --->
<cfset nNewPosition = 0> <!--- Next position to start with after finding a
tab --->
<cfset nNumTabs = 0> <!--- Number of tabs. Return this variable --->
<cfset sTab = #Chr(9)#> <!--- Tab character --->
<!--- Go through the string --->
<cfloop condition="(#nNewPosition# LT #nLength#)">
<cfset nNewPosition = nPosition + 1>
<cfset nPosition = #Find(sTab,sOrderFile,nNewPosition)#>
<cfif nPosition EQ 0> <!--- No more tabs, done --->
<cfbreak>
</cfif>
<cfset nNumTabs = nNumTabs + 1> <!--- Start looking for new tab 1
position after last one --->
</cfloop>
<!--- Return nNumTabs here --->
<cfoutput>#nNumTabs#</cfoutput>
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.