Improve regexp hook execution