No, you're right about the all. I'm confusing the refind() and
rereplace() syntax.
But, yes. By using a regex in the condition, you are running it twice
per loop.
--Ben Doom
Bobby Hartsfield wrote:
The option is called 'returnsubexpressions' and valid values are true or
false. You can
Ahh... I was REALLY hoping you were right about that. That would have been
great. In any event, I learned something new about refind() so thanks! I'll
always think of you and the time we shared in this thread when I use it.
hehe
As for running the regex twice... Since looping a space delimited
Here's what I usually do:
cfscript
loc = refind(text, thing, 1, 1);
while (loc.pos[1])
{
//do stuff
loc = refind(text, thing, 1, loc.pos[1]+loc.len[1]);
}
/cfscript
It's 1 extra line of code, but it means only doing n+1
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
Use the number character class.
provided that there are no other sort of numbers in the field.
If yes, see CF_REextract here:
http://www.contentbox.com/claude/customtags/REextract/testREextract.cfm
You can test it here:
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
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
# /
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
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
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
: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
, 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 option is called 'returnsubexpressions' and valid values are true or
false. You can only return one instance of a match with refind() (and
possibly one instance of a sub expression match if you use parens in the
expression). To get more, you have to run the function again with a
different
12 matches
Mail list logo