sql去除注释

https://www.shangmayuan.com/a/39a8fba001d84c168f35488e.html

该方法,能在保持原有代码的状况下,好比大小写,换行,缩进等信息,去除sql中的各类注释
代码以下web

Pattern p = Pattern.compile("(?ms)('(?:''|[^'])*')|--.*?$|/\*.*?\*/|#.*?$|");
String presult = p.matcher(sql).replaceAll("$1");
return presult;

包括sql

横杠注释ruby

  --drop table report.rpt_employee_fund_match;
--create table report.rpt_employee_fund_match as 
/*  insert into report.partner_open_account_stat_tmp
  -- where to_number(to_char(a.create_date,'YYYYMMDD'),'99999999') <= v_period_id
*/ -- delete by zak 20140623

包括不去掉原有代码里面的注释,很是强大svg

select employee_id, max(cast(organization_id as integer)) 
organization_id 
from src_ht_hr_ims.ims_rt_employee_organization where state=1
and jobtitle <>'--' --and employee_id='50019940'
group by employee_id                     
原文地址:https://www.cnblogs.com/xuxm2007/p/15148462.html