我要从img(9.gif)里取9.gif如何取呢?Pattern p = Pattern.compile("正则")
String s = "img(9.gif)";
Matcher match = p.matcher(s);
if ( match.find() ) {
System.out.println(match.group(0));}类似这种的可用么?可用的话,我的正则咋写啊?先谢过啦
String s = "img(9.gif)";
Matcher match = p.matcher(s);
if ( match.find() ) {
System.out.println(match.group(0));}类似这种的可用么?可用的话,我的正则咋写啊?先谢过啦
int a = s.indexOf("(");
int b = s.indexOf(")");
s = s.substring(a, ++b);
System.out.println(s);
int a = s.indexOf("(");
int b = s.indexOf(")");
s = s.substring(++a, b);
System.out.println(s);