Improve regex matching