Add check for empty sequence or regex.