In Notepad++ i have a text something like this:
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);

