Optimising match_in_text