Amazon interview question

validate string with regEx and arrays question