Regex fixes thanks to @nasonfish