Skip to content

Instantly share code, notes, and snippets.

@raymcdermott
Created April 7, 2011 21:21
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 raymcdermott/908753 to your computer and use it in GitHub Desktop.
Save raymcdermott/908753 to your computer and use it in GitHub Desktop.
recursive java
public String scrubOut(String line, Collection<String> keys) {
if (keys.isEmpty()) return line;
else {
String key = keys.iterator().next();
keys.remove(key);
return scrubOut(line.replaceAll(key + "=\".*?\"", key + "=\"****\""), keys);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment