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

Name of function and its parameter
matchContents(contents,pattern)

Description
returns an array of indexes of each page in contents that match pattern (match in the style of function 3)

Examples
matchContents(contents,"LU") returns [0,1]
matchContents(contents,"other") returns [0,2]

Thanks!