Using the MATCHES Function
The syntax for the matches function is:
matches(string1, string2)
The matches function returns the number of times string1 appears in string2. The comparison is not case sensitive. The comparison is word oriented, thus matches(“b”, “abc”) will return zero (no matches), but matches(“b”, “a b c”) will return one, as will matches(“B”, “a_b_c”).
Example Spec:
~comment&matches.doc~defone: [$s="THIS IS A LINE."]two: [$s="this is a line."]thr: [$s="if this then that endif"]fou: [$s="if_this_then_that_endif"]fiv: [$s="if-this-then-that-endif"]six: [$s="if0this0then0that0endif"]~cleansay matches("a","a")say matches("a","a b")say matches("a","a b a")say matches("a","a ba")say matches("a","a ab")say matches("B", "a_b_c")say matches("456","123 123456 45678 12345678")say matches("This",one)say matches("This",two)say matches("if",thr)say matches("THIS",fou)say matches("THIS",fiv)say matches("THIS",six)~end