I write small scripting 'language' for my game.
I would like to allow for every JS string literal strings(`"'
).
I figured out how to check everything inside those using:
(?<e1>""|'|`)(?:\$\k<e1>|(?!\k<e1>).)*\k<e1>)
It works.
But now, I have a different trouble. I need to remove all tabs, that are not inside those types of quotes.
I looked up here how to match everything, that is not inside quotes:
\t(?=([^"\\]*(\\.|"([^"\\]*\\.)*[^"\\]*"))*[^"]*$)
And I got trouble connecting those two worlds so that "a`\t`"
does not remove this middle tab as
\t(?=([^"'`$]*(\$.|['`"]([^"'`$]*\$.)*[^"'`$]*["`']))*[^"`']*$)
does. I know, I have to check for the last not-escaped (with $
not \
) quote, but how do I do that?