Really?  I thought that is what I was using in 6.1.  I'm sure the docs 
can set you straight on what syntax is correct.

Regardless, you are running the regex twice per loop, which is at least 
twice as often as you need to.  Even if you have to run it once per 
loop, run it, store it, and check what you stored.

--Ben Doom

Bobby Hartsfield wrote:
> Hah crybaby! ;-)
> 
> I tried 'all' but it just throws an error on 6.1 
> 
> ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
> Bobby Hartsfield
> http://acoderslife.com
> 
> 
> -----Original Message-----
> From: Ben Doom [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 05, 2007 1:55 PM
> To: CF-Talk
> Subject: Re: Regex search problem
> 
> Don't do the refind() in the loop.  Running it once with "all" specified 
> will return (you're right on this one) a struct of arrays.  It will find 
> all of the matches (hence scope "all" :-P).
> 
> You then only need to loop over the results.  Much more efficient.
> 
> Plus, OMG, you're using a condition that runs the regex and throws away 
> the answer.  Don't do that.  Ever.  Please.  It makes me weep.
> 
> --Ben Doom
> 
> Bobby Hartsfield wrote:
>> Likea so...
>>
>> <cfset txt = "this is a test testId67Text more text more text testId49Text
>> more text testId54Text more text testId56Text" />
>> <cfset county = 0 />
>> <cfset arrString = arrayNew(1) />
>> <cfset nums = arrayNew(1) />
>>
>> <cfloop condition="refind('testId(\d+)Text', txt)">
>>      <cfset county = county + 1 />
>>      <cfset arrString = refind('testId(\d+)Text', txt, 1, true) />
>>      <cfset nums[county] = mid(txt, arrString['pos'][2],
>> arrString['len'][2]) />
>>      <cfset txt = removechars(txt, arrString['pos'][1],
>> arrString['len'][1]) />
>> </cfloop>
>> <cfdump var="#nums#" />
>>
>>
>> ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
>> Bobby Hartsfield
>> http://acoderslife.com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292707
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to