Hey, please can someone help me work out a code for this function

Name of function and its parameter
score(string,pattern)

Description
returns the number of times that pattern occurs in string (overlapping matches count) (case insensitive)

Examples
score("THAT hat!","hAt") returns 2
score("Coooool!","OO") returns 4

Thanks!