If there is only one “word” in front of a RegEx string in Ruby, it will botch up the syntax highlighting if there is an escaped quote in the RegEx.
For example:
When /^\"(^\"]+)\"$/
Everything after the first escaped quote won’t highlight correctly. For some reason, this is fixed if there is a double escaped ending quote, like this:
When /^\"\\"$/
This case probably doesn’t happen often in coding, but it is perfectly valid code. The “When …” syntax above is often used in the Ruby gem Cucumber. Also, I could see it happening when a RegEx is passed to a function as an argument:
foo /^\"bar\"$/
Putting the argument in parentheses fixes the highlighting, but the former is still valid syntax.