refactored regex compiler
refactor