Moved Regex mapping logic into a worker thread

This change is needed to 1) keep the UI responsive during the long generation
and 2) prepare for more multithreaded developments.