fixed stringToMatch to take array as argument