Regular Expressions 101

Community Patterns

1...34567...901

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
(")?([^{:"]+)(")?(: )(")?([^,}"]+)(")?(, |}+)
/
g

Description

This Regex allows to add double-quotes to a JSON string that is missing them. It assumes we have a space after the ":" and also after the ",".

Submitted by anonymous - a year ago