0

I have a regex that works, as seen in https://stackoverflow.com/a/74576808/1432181.

\(\s*/.*?/\w*\h*,(*SKIP)(*F)|(?|(")[^"\\]*(?:\\.[^"\\]*)*"|(')[^'\\]*(?:\\.[^'\\]*)*')

This selects any kinds of content inside matching quotes, ignoring escaped quotes, ignoring when in the first argument of a .replace() [which may be things like .replace(/'/g, ...)

(See https://regex101.com/r/42rHQx/1)

But how can I get the opposite of this (i.e. where it's blue in the regex101, I want it not selected - and where it was previously not selected I want it blue)?

(I need to use this in a preg_replace so that I can only replace things outside of the shown selected [quoted] content)

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
user1432181
  • 918
  • 1
  • 9
  • 24

0 Answers0