Skip to content

Instantly share code, notes, and snippets.

@capnslipp
Created September 1, 2011 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save capnslipp/1186489 to your computer and use it in GitHub Desktop.
Save capnslipp/1186489 to your computer and use it in GitHub Desktop.
RegExp'ing in JSON
var endOfScopeMarker = '\t\t},';
var find = new RegExp('"someProperty" : 3((?:(?!'+endOfScopeMarker+').|\n)+)("anotherPropertyWithinTheSameScope" : 1,)', "g");
var replace: '"someProperty" : 0$1$2';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment