public static void main(String[] args) throws Exception {
String queryForScanUsers_SQL = "select a.username AS user_name,b.* from tbl_aaa a left join tbl_bbb b where a.id=? limit 10";
//去除WHERE和LIMIT
String sqlRegex = "(select\\s+)(.*)(\\s+from)(.+?(?=limit))";
Pattern p = Pattern.compile(sqlRegex, Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(queryForScanUsers_SQL);
while (m.find()) {
//SELECT
System.out.println(m.group(1).trim());
//Columns,分页中求总条数需替换成COUNT(1)
System.out.println(m.group(2).trim());
//FROM
System.out.println(m.group(3).trim());
//Tables
System.out.println(m.group(4).trim());
} HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
format.setCaseType(HanyuPinyinCaseType.LOWERCASE); //小写拼音字母
format.setToneType(HanyuPinyinToneType.WITHOUT_TONE); //不加语调标识
format.setVCharType(HanyuPinyinVCharType.WITH_V); //u:的声母替换为v
StringBuilder sb = new StringBuilder();
System.out.println(PinyinHelper.toHanyuPinyinString("张三feng", format, ""));
}