I'm trying to write a regex that will match Oracle q-quotes for a PL/SQL lexer in code-prettify.js. For example,
q'[Here's Johnny]'
This should be matched the same as
'Here''s Johnny'
(that is, so that SQL will treat it all as one text string. The advantage of q-quotes over the conventional two-single-quotes is you don't have to go through your text string doubling up all of your single quotes.)
The quote delimiter can be any of [, {, <, or (, but I think if I can get it working with one bracket type then I can repeat the variations as ORs, like
/^(?:pattern1|pattern2|pattern3))/
Ultimately I want a single regex that will match an ordinary single-quoted string or a q-quote with any of the bracket types.
'Here''s Johnny'
? That's a double ' or a single " ?