Use regex to parse config file.

Makes parsing somewhat more robust.