Changed string contains method to regex pattern