Skip to content

Instantly share code, notes, and snippets.

@WLPhoenix
Created May 21, 2014 20:09
Show Gist options
  • Save WLPhoenix/13fb155f2d56cee90a07 to your computer and use it in GitHub Desktop.
Save WLPhoenix/13fb155f2d56cee90a07 to your computer and use it in GitHub Desktop.
Java - Split between two characters
import java.util.regex.*;
public class LookbehindSplit {
public static void main(String[] args) {
String split_regex = "((?<=\\])(?=\\[))";
String[] test = "[1][2][3\\]3][4\\[4]".split(split_regex);
for (String s : test) {
System.out.println(s);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment