I'm working on a project where I sadly can't use Pygments directly, but I am nonetheless trying to take advantage of its lexers, at least the ones that are purely regex-based (without overriding get_tokens_unprocessed). To do this, I refactored RegexLexerMeta so that there are separate methods to translate each component of a token tuple. My code then overrides those methods to, for instance, keep the regular expressions as strings instead of compiling them into matcher functions.
I think that the refactoring is generally useful and a good idea in its own right. Would you consider accepting it as a patch?
Reported by ArthurDenture