Amazon Interview Question

How to do various things with regex.