Ara
Ara

Reputation: 409

Notepad++ remove carriage return between two words

I have some text in a file e.g

CREATE
   INDEX TST_NK ON TST.TEST_DIM
  (
    TSL_ID
   )
    DEFER NO ;
CREATE
   INDEX TST_NK ON TST.TEST_DIM
  (
    TSL_ID,
     DES_ID
   )
    DEFER NO ;

I want to remove all return characters between CREATE and ;

In notepad++ i'm able to search this text using regex CREATE\b(.+?); however i'm not sure how to replace the return characters in this text so that i can have all the create statements in single line.

Upvotes: 0

Views: 1072

Answers (1)

nhahtdh
nhahtdh

Reputation: 56809

Find what:

(?<=[^\s;])\s*\n\s*

Replace with: (single space)

Then hit Replace All

It will search for any sequence of space character, where there is at least one new line character for replacement. The look-behind is used to make sure that there is no ; in front of such sequence.

Upvotes: 5

Related Questions