EPAM Systems interview question

Event loop, special regex logic