Used a parsing library instead of my own dodgy regex.