Meta interview question

Implement a simple regex parser.