0

In Notepad++ i have a text something like this:

enter image description here

To select all lines which contains string "EMPLOYEES" and ends with ";" i use:

^.*\bEMPLOYEES[\s\S]*?;

So the following text is selected:

CREATE TABLE EMPLOYEES (
EMPLOYEE_ID                             NUMBER(6,0)         NOT NULL,
  FIRST_NAME                              VARCHAR2(20)        NULL,
  LAST_NAME                               VARCHAR2(25)        NOT NULL,
  EMAIL                                   VARCHAR2(25)        NOT NULL,
  PHONE_NUMBER                            VARCHAR2(20)        NULL,
  HIRE_DATE                               DATE                NOT NULL,
  JOB_ID                                  VARCHAR2(10)        NOT NULL,
  SALARY                                  NUMBER(8,2)         NULL,
  COMMISSION_PCT                          NUMBER(2,2)         NULL,
  MANAGER_ID                              NUMBER(6,0)         NULL,
  DEPARTMENT_ID                           NUMBER(4,0)         NULL);

ALTER TABLE TABLE1 ADD (
  CONSTRAINT TAB1_EMPLOYEES_FK 
  FOREIGN KEY (EMP_ID) 
  REFERENCES EMPLOYEES (EMPLOYEE_ID);

COMMENT ON TABLE EMPLOYEES IS 
'employees table. Contains 107 rows. References with departments, 
jobs, job_history tables. Contains a self reference.';

Now i wan't to select the same lines, except those lines which contains words "EMPLOYEES" AND "FOREIGN" and char ";" (and the rule above remains the same).

For example, this should not be selected:

ALTER TABLE TABLE1 ADD (
  CONSTRAINT TAB1_EMPLOYEES_FK 
  FOREIGN KEY (EMP_ID) 
  REFERENCES EMPLOYEES (EMPLOYEE_ID);
zoki182
  • 77
  • 1
  • 6
  • 1
    Apparently you don't know where to start with your regex. Please check out [Reference - What does this regex mean resource](https://stackoverflow.com/questions/22937618), and [Learning Regular Expressions](https://stackoverflow.com/questions/4736) for more info on regex. – Christian Baumann Oct 08 '20 at 12:32
  • `[\s\S]*` means literally anything. – Robo Robok Oct 08 '20 at 22:14

0 Answers0