Pergunta de entrevista da empresa Riot Games

How would you have solved this with Regular Expressions?