Cruise interview question

Asked me to essentially write a regex matching function