If you're going to need to loop through a large file and get multiple lines
of the same data, try the following:
<cfset startPos = ReFindNoCase( "^Block Info
([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}) Blocked.$", logFileContent,
1, True)>
<cfset counter = 1>
<cfset arrIPAddr = ArrayNew(1)>
<cfloop condition="startPos.pos[1] NEQ 0">
<cfset arrIPAddr[counter] = Mid( logFileContent, startPos.pos[2],
startPos.len[2] )>
<cfset counter = counter + 1>
<cfset startPos = ReFindNoCase( "^Block Info
([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}) Blocked.$", logFileContent,
startPos.pos[2] + startPos.len[2], True)>
</cfloop>
I haven't tested this code, but it should be pretty close to what you're
looking for.
-----Original Message-----
From: Scott Wilhelm [mailto:[EMAIL PROTECTED]
Sent: Monday, September 22, 2003 1:18 PM
To: CF-Talk
Subject: Find A Pattern
Hello:
I'm trying to find a data in between a pattern of text from a string...How
would I go about getting it?
For example, I want to get the ip address from this string "Block Info
163.153.124.62 Blocked."
Thanks,
Scott
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137972
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
http://www.cfhosting.com