Regular Expressions 101

Community Patterns

123...6

I need to escape " in json, issue: if they are already escaped

1

Regular Expression
PCRE (PHP <7.3)

/
(?:(?<!\\)|(?<=\\\\))(\")
/
g

Description

I'm having issues escaping quotes inside json content. I can get the " to be put in if " is seen, the issue is I don't want that to be done if " is in the content (as that is already escaped)

Submitted by Patrick - 10 years ago