getMatchingAnnotations function

Gets a list of annotations that match a particular pattern