Moved Regex logic to its own file. Fixed a typo.