即从
select * from abc 获取abc
当然sql可能复杂多了。。比如
select a,b,c from a where id=1 order by id desc
SELECT * from a group by age这样。求具体的java代码(对JAVA操作正则不太了解..@_@)
select * from abc 获取abc
当然sql可能复杂多了。。比如
select a,b,c from a where id=1 order by id desc
SELECT * from a group by age这样。求具体的java代码(对JAVA操作正则不太了解..@_@)
解决方案 »
- 关于读取properties配置文件的问题
- 怎么把数据源从Spring配置文件移动到properties文件就不行了?
- 用文件存储对象 用ObjectInputStream循环读取
- 关于KeyListener的问题
- 怎么将Byte类型 转化成 Byte[4] 数组
- 关于OA
- 怎么获得一个我需要的格式的时间?
- 关于内部类的一些问题。【静态成员类】【成员类】【局部类】【匿名类】的用法?
- 注意
- 求真正的JAVA应用项目!
- [Microsoft][SQLServer 2000 Driver for JDBC]Column index 6 is out of range.这是什么原因
- Java的switch语句支持byte、short、char、int、long、String和enum(枚举)吗?
String regex="\\bfrom\\s*\\S*";
Pattern p=Pattern.compile(regex);
Matcher m=p.matcher(sql);
if(m.find()){
String table=m.group().replace("from","");
System.out.println(""+table.trim());
}else{
System.out.println("not found");
}
Pattern p=Pattern.compile("(.*from\\s)(\\w*)(.*)");
Matcher m=p.matcher(str);
if(m.find()){
System.out.println(m.group(2));
}else{
System.out.println("false");
}