Method RegEx():matchAll() Foundation
Finds all matches.
:matchAll( <cSubject>, [<nLimit>] ) --> aMatches
An array with information about the matches. If no match is found, return is an empty array ({}).
Each array element contains a sub-array with information about a match result. The structure of these sub-arrays is identical to that returned by the method :match(). See there for a detailed description. Also see the helper methods :getMatchText(), :getMatchPos() and :getMatchRange() and the example below for more information on processing the array returned by :matchAll().
Returns an array containing detailed information about all non-overlapping matches of the pattern in the subject string.
Match all
oRegEx := RegEx():create("\d+")
aMatches := oRegEx:matchAll("10 cats, 20 dogs, 30 birds")
FOR nMatch := 1 TO Len(aMatches)
aMatch := aMatches[nMatch]
? RegEx():getMatchText(aMatch) // "10", "20", "30"
NEXT
oRegEx:destroy()
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.