Skip to content

Instantly share code, notes, and snippets.

@johndemic
Created January 12, 2011 20:50
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 johndemic/776853 to your computer and use it in GitHub Desktop.
Save johndemic/776853 to your computer and use it in GitHub Desktop.
import org.apache.commons.io.FileUtils
def json = FileUtils.readFileToString(new File("assets.json"))
def matcher = json =~ /\{ ".oid" : ("[0-9a-f]{24}") \}/
def stringBuffer = new StringBuffer();
matcher.reset()
while (matcher.find()) {
matcher.appendReplacement(stringBuffer, matcher.group(1));
}
matcher.appendTail(stringBuffer);
println stringBuffer.toString()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment