Use std.regex.replaceAll instead of replace().

replace() is now deprecated and required the regex to be compiled with
specific flags; the new API uses replaceAll().
Refactor code to be unittestable.

I'm ashamed of the fact that I wrote this program with zero unittests!
Merge pull request #82 from quickfur/replaceAll

Use std.regex.replaceAll instead of replace().