Aris
Aris

Reputation: 21

Notepad++ add text between every line

I want to add a text (eg. HELLO) between each Line

For example:

Line 1
Line 2
Line 3

make it:

Line 1
HELLO
Line 2
HELLO
Line 3
HELLO

Upvotes: 0

Views: 4497

Answers (4)

Khale_Kitha
Khale_Kitha

Reputation: 254

My first thought would be to use a form of Regular Expression in the Find/Replace. I expect that your sample, used here, is not exactly what you're trying to do, but to solve the sample, try the following in the Find/Replace dialog.

([\d]{1})[\s]{1}

This will find 1 digit, followed by 1 space, and replace it with the 1 digit, followed by " HELLO "

See an explaination of the regular expression pieces, here: https://regex101.com/r/wW8cG2/1

Upvotes: 0

Toto
Toto

Reputation: 91373

You could do:

  • Ctrl+H
  • Find what: (\R)
  • Replace with: $1HELLO$1
  • Replace all

\R stands for any kind of line break, the added lines will have the same line break as the original lines.

Upvotes: 0

ilia
ilia

Reputation: 1132

  • Press CTRL-H to replace
  • in Find what - type \n
  • in Replace with - type \nHELLO\n
  • Select Extended in Search mode
  • Press Replace All

Upvotes: 2

ClickRick
ClickRick

Reputation: 1562

A simple search/replace will do the job here, looking for \r\n and replacing it with \r\nHELLO\r\n. The important thing is to have selected the Extended Search mode (at the bottom of the search/replace dialog), so the control characters can be specified in this way.

Upvotes: 0

Related Questions