Stack Overflow doesn't have a syntax highlighting engine; it uses Google Prettify.
In order to change the current behaviour you can either raise an issue or submit a fix yourself. Stack Overflow's syntax highlighter will then be automatically updated when the latest version of Prettify is pulled.
Having said that even with an explicit language hint (
<!-- language: lang-sql -->) a
\ is normally not used as an escape, though it is not rendered as a string literal.
To take a portion of your example (this is quite difficult to see on my screen) it's still almost working
select ('^(.*?)(<.*?>)$', '\'||pos), blah
It's only the addition of more single quotes that causes it to break
select ('^(.*?)(<.*?>)$', '\'||pos)