Method RegEx():count() Foundation

Counts all matches.

Syntax
:count( <cSubject> ) --> nCount
Parameters
<cSubject>
The subject string to search.
Return

The number of matches found.

Description

Returns the total number of non-overlapping matches of the pattern in the subject string. This method scans the entire string and counts all occurrences.

Count

oRegEx := RegEx():create("\b\w+\b")  // Word pattern 
nWords := oRegEx:count("The quick brown fox") 
? nWords  // 4 
oRegEx:destroy() 

Feedback

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.