refactor(TE): Move TransformationEngine into a distinct module (refs #4568)

Also:
- Cleaned up regexes