notepad++正则表达式⾼级查替换技巧(⼀)
正则表达式:(^\w+$)
替换式:db2 \"delete from \1 \" \r\ndb2 \"import from \.\/data\/\1\.ixf of ixf modified by identityignore insert into \1 \"输⼊:
PERMODLOG
RESERVEDETAIL
RESERVEMAIN
输出:
db2 "delete from PERMODLOG "
db2 "import from ./data/PERMODLOG.ixf of ixf modified by identityignore insert into PERMODLOG "
db2 "delete from RESERVEDETAIL "
db2 "import from ./data/RESERVEDETAIL.ixf of ixf modified by identityignore insert into RESERVEDETAIL "
db2 "delete from RESERVEMAIN "
db2 "import from ./data/RESERVEMAIN.ixf of ixf modified by identityignore insert into RESERVEMAIN "
正则表达式:(^\w+$)
替换式:db2 \"export to \.\/data\/\1\.ixf of ixf select \* from \1 \"
输⼊:
PERMODLOG
RESERVEDETAIL
RESERVEMAIN
输出:
db2 "export to ./data/PERMODLOG.ixf of ixf select * from PERMODLOG "
db2 "export to ./data/RESERVEDETAIL.ixf of ixf select * from RESERVEDETAIL "
db2 "export to ./data/RESERVEMAIN.ixf of ixf select * from RESERVEMAIN "
正则表达式:(alter.*\))
替换式:execute immediate '\1'
输⼊:
alter table MonQryApply add constraint PK_MonQryApply primary key (orderID);
alter table sRegInfo add constraint PK_sRegInfo primary key (MachID);
输出:
execute immediate 'alter table MonQryApply add constraint PK_MonQryApply primary key (orderID)';
execute immediate 'alter table sRegInfo add constraint PK_sRegInfo primary key (MachID)';
正则表达式:ASC\)\s*tablespace GZHINDEX\s*pctfree 10\s*initrans 2\s*maxtrans 255\s*storage\s*\(\s*initial 64K\s*next 1M\s*minextents 1\s*maxextents unlimited\s*\);
替换式:ASC\);
作⽤:去掉以下sql中的ASC)后⾯的内容。
CREATE INDEX IX_BANKCHECKDAILYREP_CHECKDATE
ON BANKCHECKDAILYREP (CHECKDATE ASC)
tablespace GZHINDEX
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
-- ----------------------------
-- Indexes structure for table BANKCHECKDAILYREP_LIST
-- ----------------------------
CREATE INDEX IX_BANKCHECKLIST_CHECKDATE
ON BANKCHECKDAILYREP_LIST (CHECKDATE ASC)
tablespace GZHINDEX
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
正则表达式:^select \*(.+)$
替换式:delete \1 ;
作⽤:把select * 替换成delete , 同时在⾏尾加分号
正则表达式:^INSERT INTO
替换式:go\r\nINSERT INTO
作⽤:每⼀⾏的前⾯增加⼀个新⾏,内容为go
正则表达式:^(\w+.+)$
替换式:\1\r\ngo
notepad++作⽤:每隔⼀⾏增加⼀个新⾏,内容为go
正则表达式:^(--.*)$
替换式:空
作⽤:去掉以“--”开始的注释
扩展模式替换
查⽬标:);
替换: ASC)\r\n tablespace GZHINDEX\r\n pctfree 10\r\n initrans 2\r\n maxtrans 255\r\n storage\r\n (\r\n initial 64K\r\n next 1M\r\n minextents 1\r\n maxextents unlimited\r\n );\r\n
输⼊:
create index IX_BUSINESSLIST_ATM_ACCOUNTNO on BUSINESSLIST_ATM (ACCOUNTNO);
create index IX_BUSINESSLIST_ATM_COREID on BUSINESSLIST_ATM (COREID);
create index IX_BUSINESSLIST_ATM_INSERDATE on BUSINESSLIST_ATM (INSERTDATE);
输出:
create index IX_BUSINESSLIST_ATM_ACCOUNTNO on BUSINESSLIST_ATM (ACCOUNTNO ASC)
tablespace GZHINDEX
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
create index IX_BUSINESSLIST_ATM_COREID on BUSINESSLIST_ATM (COREID ASC) tablespace GZHINDEX
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
create index IX_BUSINESSLIST_ATM_INSERDATE on BUSINESSLIST_ATM (INSERTDATE ASC) tablespace GZHINDEX
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
给冠字号两侧加单引号
输⼊:
WFD545
FDS654A
FDS7887
正则表达式
^(\w+)$
'\1',
输出:
'WFD545',
'FDS654A',
'FDS7887',
(nvl\(.*),\s*''\)\s*=\s*''
\1, 'N'\)='N'
输⼊:
nvl(:new.pertype,'')<>nvl(:old.pertype,'')
select nvl(cashid,'') into v_cashid from
正则表达式:
(nvl\(\s*[:.\w]*\s*),\s*''\s*\)
\1, 'N'\)
输出:
nvl(:new.pertype,'N')<>nvl(:old.pertype,'N')
select nvl(cashid,'N') into v_cashid from
/
truncate table (\w+)/
/alter table \1 activate not logged initially with empty table;/

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。