Replace string operations with regex

I think regexes are a better match (hah!) to this kind of problem.

TODO: move the compilation steps to somewhere where they are run only once.
Merge pull request #1 from boppreh/patch-1

Replace string operations with regex