Better Regex & added Locals object

Thanks to https://github.com/tomsmeding for help with the Regex!