Kaya 0.5.2 reference for Regex::count

List of functions and data types in Regex

Int count(Regex patt, String str)

Arguments

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

Related

kaya@kayalang.org | Last modified 29 November 2011 | Supported by Durham CompSoc | Powered by Kaya