Introducing the Token Map

The WP_Token_Map class in WordPress 6.6 efficiently answers the question: “Does this string at this offset contain one of a known set of tokens, and if it does, what is the replacement value for that token?”