REFACTOR: Reusing regexp functions