REFindAll(regex, text) -> Struct
REFindAllNoCase(regex, text) -> Struct
This function would return a struct with two keys "pos" and
"len" (just like REFind) except each element in the array would
correspond to each match in the string. This is useful if you want to
get all the matches of a particular regex.
I'd have to test to verify but I believe the "subexpression flag" in REFind in OpenBD does just that:
http://openbluedragon.org/manual/?/function/refind
Is that what you're after?
--
CFML Conventional Wisdom
http://groups.google.com/group/cfml-conventional-wisdom?hl=en?hl=en
That gives a bit more flexibility/performance, (for example if you
only want the first four matches of something containing 50 matches,
or whatever).
> REEscape(string) -> string
> This function returns a string with all non-alphanumerics backslashed.
I was going to point out that this is overkill (not all non-alnum need
escaping), but it looks like the .quotemeta() function in the Apache
ORO library (which CF uses) does exactly what you're suggesting
anyway.
Personally I tend to use Java regex, which supports \Q..\E inline plus
has a Pattern.quote() function (which handles content that might
contain \E)
If the expression still needs to be readable afterwards, the \Q..\E is
probably clearer, but those are explicitly not supported in the
current Apache ORO, so escaping each char is the only option.
Given the names of both of those, I'd probably say go with REQuote as
the name, even though REEscape is what I would have used too.
Infact, no reason for refind and rematch not to have the exact same
argument structure:
( reg_expression , string , start , subexpression , matchcount )
And would be good to replace the one/all scope of rereplace with an
numeric count too (though that would have compatibility issues)