Added the ability to set the pattern in the case of an empty array