Amazon Interview Question

validate string with regEx and arrays question