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 -----Original Message----- From: Ben Doom [mailto:[EMAIL PROTECTED] Sent: Monday, November 05, 2007 11:37 AM To: CF-Talk Subject: Re: Regex search problem You can do an refind(text, "\d+", 1, "all") refind in text digits starting at position one find all This will return an array of structs with keys pos and len. Pos is the start position, and len is the length. You can then use mid() to grab them. --Ben Doom Web Exp wrote: > Thanks Ray... > Ok... I guess I should have clarified that I am using CF MX7, so I > cannot use reMatch function. > Also, what I am looking for is to find a list of numbers between the > strings: "testId" and "Text" in this pattern: > "testId67Text more text more text testId49Text more text testId54Text > more text". I need to extract 67,49,54. > Note: I do not need all the umbers, I want them only if they are > present in that pattern. > > Thanks, > K > > On 11/5/07, Raymond Camden <[EMAIL PROTECTED]> wrote: >> Use the number character class. >> >> >> <cfsavecontent variable="test"> >> testId67Text more text more text testId49Text more text testId54Text more text >> </cfsavecontent> >> >> <cfset numbers = reMatch("[[:digit:]]+", test)> >> <cfdump var="#numbers#"> >> >> >> On Nov 5, 2007 9:30 AM, Web Exp <[EMAIL PROTECTED]> wrote: >>> Hi. I have a bunch of text in a db table that has multiple occurances >>> of this pattern: >>> "testId67Text more text more text testId49Text more text testId54Text more text" >>> >>> How can I get all the numbers from it? i need 67,49,54. >>> >>> I know it need regex. But I need help. >>> >>> Thanks, >>> K >>> >>> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Get involved in the latest ColdFusion discussions, product development sharing, and articles on the Adobe Labs wiki. http://labs/adobe.com/wiki/index.php/ColdFusion_8 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292676 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4