I need to get a valid javascript string from text, I tried a lot, but escape characters are bothering me.
Here's code:
Regexp:
const Regexp = /(["']).*?((?<!\\)\1)/;
It does work sometimes
text:
'$$\''expect:
'$$\''text:
'\\''expect:
'\\'unexpected:
'\\''Note: Two
\is a valid javascript string, so the'after\\is the correct closing quotes.