Is there any way to use the listings package (which I already use for Python) to highlight regexes? I.e. the regex appears in the document as if it were source code, but with some form of differentiation between (for example) literals and character classes, escaped control characters and real control characters.
It's not an uncommon feature in online regex testing tools.
For what it's worth, the regexes being discussed in my document are to be used for find/replace on LaTeX code, and will appear as
EDIT background colour seems common for this:
- http://regexpal.com/ -- almost(?) identical to regexbuddy
Sublime text apparently does character-colour highlighting:
This would seem to be (i) subjectively nicest, and (ii) most compatible with existing listings.
For reference https://www.debuggex.com/ has a nice visual parser which goes much further than anything (i) I had considered, and (ii) that would be possible in a text-based framework.