Riot Games Interview Question

How would you have solved this with Regular Expressions?