Skip to content

Instantly share code, notes, and snippets.

@taichi
Created January 19, 2011 10:23
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 taichi/785968 to your computer and use it in GitHub Desktop.
Save taichi/785968 to your computer and use it in GitHub Desktop.
static void brace() {
String regex = "((?=\\[.+\\])\\[?[a-z]+\\]?)";
Pattern p = Pattern.compile(regex);
String[] datas = { "[aaaa]", "[aaaa", "aaaa]", "aaaa" };
for (String s : datas) {
System.out.println(s);
System.out.println(p.matcher(s).matches());
System.out.println("********");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment