I'm voting for option 2. I've never seen a syntax highlighter for a rich language that works perfectly--except maybe Lisp highlighting in Emacs--and when the highlighting fails I'd rather it fail to the plainest highlighting possible.
And adding a no-op "signal" to raw strings that will later be used as regexes just to turn on some coloring seems very unPythonic in that:
It is ugly. It is implicit. It adds complexity. It detracts from readability. It is not the obvious way to do it.
- Match raw strings that are arguments to methods from the re
module. We will sometimes not match raw strings that are regular expressions, but can be pretty well guaranteed to never have a false- positive.