Akim Prestatic
Akim Prestatic

Reputation: 134

Replace content between two words notepad++

do you know how to remove a text between two words in notepad ++

VALUES (1, NULL, NULL,
VALUES (2, NULL, NULL,
VALUES (3, NULL, NULL,

to

VALUES (NULL, NULL,

Upvotes: 0

Views: 1400

Answers (3)

Toto
Toto

Reputation: 91518

  • Ctrl+H
  • Find what: VALUES \(\K[^,]+, ?
  • Replace with: LEAVE EMPTY
  • check Wrap around
  • check Regular expression
  • Replace all

Explanation:

VALUES \(   # literally
\K          # forget all we have seen until this position
[^,]+       # 1 or more not comma
, ?         # a comma followed by an optional space

Result for given example:

VALUES (NULL, NULL,
VALUES (NULL, NULL,
VALUES (NULL, NULL,

Screen capture:

enter image description here

Upvotes: 1

Akim Prestatic
Akim Prestatic

Reputation: 134

resolved

VALUES.*?NULL

VALUES\(NULL

Upvotes: 0

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522506

If you just want to remove the first entry from each VALUES clause, then try the following find and replace, in regex mode:

Find:    VALUES \([^,]+,\s*
Replace: VALUES (

Check the demo link below to a working example.

Demo

Upvotes: 1

Related Questions