Int count(Regex patt, String str)
Arguments
patt: A compiled regular expressionstr: The String to count in
Usage
Count the number of (non-overlapping) matches for patt in str. Note that this function will not give meaningful results for patterns containing ^ or $.
count(compile("abc"),"abcdefgh"); // 1
count(compile("a"),"abcdefebcda"); // 2
count(compile("a.[^a]"),"aabbccaabbccaa"); // 2