Here's what I usually do:
loc = refind(text, thing, 1, 1);
while (loc.pos[1])
{
//do stuff
loc = refind(text, thing, 1, loc.pos[1]+loc.len[1]);
}
It's 1 extra line of code, but it means only doing n+1 searches, where n
is the
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 lis
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
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 start
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
>
>arrString['len'][2]) />
>arrString['len'][1]) />
>
>
>
>
> ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
> Bobby Hartsfield
> http://acoderslife.com
>
>
> -Original Message-
> From: Ben Doom [mailto:[EMAIL PROTECTED]
> Sent: Mond
t;
>arrString['len'][2]) />
>arrString['len'][1]) />
>
>
>
>
> ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
> Bobby Hartsfield
> http://acoderslife.com
>
>
> -Original Message-----
> From: Ben Doom [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 05,
Likea so...
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
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
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
>>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:
http://www.contentbox.com/claude/customtags/REextract/testingREextrac
Use the number character class.
testId67Text more text more text testId49Text more text testId54Text more text
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 mor
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
~~
13 matches
Mail list logo