请给我提供一个正则表达式,谢谢
发布网友
发布时间:2022-06-30 00:28
我来回答
共1个回答
热心网友
时间:2023-10-14 03:02
package com;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Kyo
{
public static void main(String[] args)
{
String sql = "select * from db1.tabel1,db2.table2 , dbdd.student where a='123';";
// String str = "select * from db1.tabel1 where a='123';";
String reg = "(([^\\.\\s,]+)\\.[^\\.\\s,]+)";
Pattern pattern = Pattern.compile(reg);
Matcher matcher = pattern.matcher(sql);
while(matcher.find())
{
System.out.println(matcher.group(2));
}
}
}