Method RegEx():batchMatch() Foundation
Matches a pattern against multiple subjects.
:batchMatch( <aSubjects> ) --> aMatches
An array with the match results. The array is organized like the input array, and contains one element with the match results for each input string. The match results are returned as an array with the same format as the array returned by method :match(). See there for a detailed description. Also see the helper methods :getMatchText(), :getMatchPos() and :getMatchRange() which simplify the processing of the match results.
Efficiently processes an array of subject strings, returning match results for each. The pattern is compiled once and reused for all subjects, providing better performance than individual matches.
Batch match
oRegEx := RegEx():create("\d+")
aTexts := {"abc123", "no numbers", "456def"}
aResults := oRegEx:batchMatch(aTexts)
oRegEx:destroy()
? Len(aResults[1]) > 0 // .T. (found "123")
? Len(aResults[2]) > 0 // .F. (no match)
? Len(aResults[3]) > 0 // .T. (found "456")
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.