Skip to content

Instantly share code, notes, and snippets.

View sophistifunk's full-sized avatar

Josh McDonald sophistifunk

  • Expantra
  • Brisbane, Australia
View GitHub Profile
@sophistifunk
sophistifunk / regex
Created September 25, 2012 12:55 — forked from anonymous/regex
regex
String inputLine = "append \"bow wow wow yippee-o yippee-ay\" dir1/dir2/file.txt";
Pattern regex = Pattern.compile("^(\\w+)\\s+\"(.*?)\"\\s+([\\w.\\/]+)$");
Matcher m = regex.matcher(inputLine);
String cmd = m.group(1); // append
String data = m.group(2); // snooplish
String path = m.group(3); // What's left