0

我想用这个工具美化 SQL 代码。在此工具接受之前,我想使用“替换”功能并选择 TextPad 中的“<*>”(不包括双引号)替换每个实例正则表达式。我怎样才能做到这一点?

在此处输入图像描述

http://www.dpriver.com/pp/sqlformat.htm

insert into i2b2demodata.QUERY_GLOBAL_TEMP ( patient_num , panel_count) select patient_num ,1 as panel_count from ( select /*+ index(observation_fact fact_cnpt_pat_enct_idx) */ patient_num from i2b2demodata.observation_fact where concept_cd IN (select concept_cd from i2b2demodata.concept_dimension where concept_path LIKE '\i2b2\Reports\%') AND ( valtype_cd = 'B' AND contains(observation_blob,'Arthritis') > 0 ) group by patient_num ) t <*> insert into i2b2demodata.DX ( patient_num ) select * from ( select distinct patient_num from i2b2demodata.QUERY_GLOBAL_TEMP where panel_count = 1 ) q <*> insert into i2b2demodata.MASTER_QUERY_GLOBAL_TEMP(master_id, patient_num, level_no) select 'masterid:22', patient_num, 0 from i2b2demodata.QUERY_GLOBAL_TEMP where patient_num IN ( select patient_num from i2b2demodata.QUERY_GLOBAL_TEMP where panel_count = 1 ) <*> delete i2b2demodata.DX <*> delete i2b2demodata.QUERY_GLOBAL_TEMP <*> insert into i2b2demodata.QUERY_GLOBAL_TEMP ( patient_num , panel_count) select patient_num ,1 as panel_count from ( select /*+ index(observation_fact fact_cnpt_pat_enct_idx) */ patient_num from i2b2demodata.observation_fact where concept_cd IN (select concept_cd from i2b2demodata.concept_dimension where concept_path LIKE '\i2b2\Diagnoses\Digestive system (520-579)\%') group by patient_num ) t <*> update i2b2demodata.QUERY_GLOBAL_TEMP set panel_count = 2 where i2b2demodata.QUERY_GLOBAL_TEMP.panel_count = 1 <*> update i2b2demodata.QUERY_GLOBAL_TEMP set panel_count = -1 where i2b2demodata.QUERY_GLOBAL_TEMP.panel_count = 2 and exists ( select 1 as panel_count from ( select /*+ index(observation_fact fact_cnpt_pat_enct_idx) */ patient_num from i2b2demodata.observation_fact where concept_cd IN (select concept_cd from i2b2demodata.concept_dimension where concept_path LIKE '\i2b2\Diagnoses\Circulatory system (390-459)\%') group by patient_num having count( distinct patient_num || '|' || encounter_num || '|' || provider_id || '|' || instance_num || '|' ||concept_cd || '|' ||cast(start_date as varchar(50) ) ) >= 3 ) t where i2b2demodata.QUERY_GLOBAL_TEMP.patient_num = t.patient_num group by patient_num ) <*> insert into i2b2demodata.DX ( patient_num ) select * from ( select distinct patient_num from i2b2demodata.QUERY_GLOBAL_TEMP where panel_count = 2 ) q <*> delete i2b2demodata.MASTER_QUERY_GLOBAL_TEMP where master_id = 'masterid:22' and level_no >= 1 <*> <*> insert into i2b2demodata.MASTER_QUERY_GLOBAL_TEMP(master_id, patient_num, level_no) select 'masterid:21', patient_num, 0 from i2b2demodata.QUERY_GLOBAL_TEMP where patient_num IN ( select patient_num from i2b2demodata.QUERY_GLOBAL_TEMP where panel_count = 2 ) <*> delete i2b2demodata.DX <*> delete i2b2demodata.QUERY_GLOBAL_TEMP <*> insert into i2b2demodata.QUERY_GLOBAL_TEMP ( patient_num , panel_count) select patient_num ,1 as panel_count from ( select patient_num from i2b2demodata.MASTER_QUERY_GLOBAL_TEMP where master_id = 'masterid:22' group by patient_num ) t <*> update i2b2demodata.QUERY_GLOBAL_TEMP set panel_count =2 where exists ( select 1 as panel_count from ( select patient_num from i2b2demodata.MASTER_QUERY_GLOBAL_TEMP where master_id = 'masterid:21' group by patient_num ) t where i2b2demodata.QUERY_GLOBAL_TEMP.panel_count = 1 and i2b2demodata.QUERY_GLOBAL_TEMP.patient_num = t.patient_num ) <*> insert into i2b2demodata.DX ( patient_num ) select * from ( select distinct patient_num from i2b2demodata.QUERY_GLOBAL_TEMP where panel_count = 2 ) q
4

1 回答 1

1

匹配 <*> 的正则表达式是<\*>.

于 2012-07-12T01:32:40.190 回答