-
-
Save sophistifunk/3781622 to your computer and use it in GitHub Desktop.
regex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment