在Notepad++中结合使用正则表达式及标记,可以事半功倍

前端之家收集整理的这篇文章主要介绍了在Notepad++中结合使用正则表达式及标记,可以事半功倍前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

目的:有一份sql代码,我们要提取出所的table name,并且生成drop table [table name];

--------------------------------------------------------
--  DDL for Table CIG_BNF_RMK
--------------------------------------------------------

  CREATE TABLE "DBO"."CIG_BNF_RMK" 
   (	"WF_POLID" VARCHAR2(30 BYTE),"WF_PLANGRP" VARCHAR2(20 BYTE),"WF_RMKITM" NUMBER(*,0),"WF_RMKITM9" NVARCHAR2(2000),) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "POLYO" ;
--------------------------------------------------------
--  DDL for Table CIG_BNF_RMK_PKG_W1
--------------------------------------------------------

  CREATE GLOBAL TEMPORARY TABLE "DBO"."CIG_BNF_RMK_PKG_W1" 
   (	"WF_POLID" VARCHAR2(30 BYTE),"WF_RMKITM9" NVARCHAR2(120),) ON COMMIT DELETE ROWS ;
--------------------------------------------------------
--  DDL for Table CIG_CLM
--------------------------------------------------------

  CREATE TABLE "DBO"."CIG_CLM" 
   (	"WF_POLID" VARCHAR2(30 BYTE),"WF_CLMNO" VARCHAR2(20 BYTE),"WF_CERTNO" VARCHAR2(20 BYTE),"WF_CONDATE" DATE,"WF_DISDATE" DATE,"WF_BNFCODE" VARCHAR2(3 BYTE),"WF_BNFCODE9" NVARCHAR2(120),"WF_CLMTYPE9" VARCHAR2(20 BYTE),"WF_INCAMT" NUMBER(19,2),"WF_PAIDAMT" NUMBER(19,"WF_SETDATE" DATE,"WF_PAYMTD" VARCHAR2(50 BYTE),"WF_PAYDATE" DATE,"WF_CLM_STS9" VARCHAR2(10 BYTE),"WF_CCY" VARCHAR2(3 BYTE),) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "POLYO" ;

先用Notepad++打开sql文件

Step 1: 菜单 ->[搜索] -> [标记]

(a)查找目标中输入正则表达式

CREATE (GLOBAL TEMPORARY TABLE|TABLE) \"DBO\"\.\"[A-Za-z0-9\_]+\"

(b)选中”标记所在行“

(c)查找模式中选中”正则表达式“

好了,按”查找全部“,看下图(可以看到查找到的行都上了色)

Step 2: 菜单 -> [搜索] -> [书签] -> [复制书签行]

然后,开个新文件,贴上就OK了,如下图(可以看到所有的CREATE TABLE ....行都复制过来了)

太好用了,给Notepad++作者点100个赞

原文链接:https://www.f2er.com/regex/358435.html

猜你在找的正则表达式相关文章