In Notepad++, how do I turn this:


into this:

  • Should be trivial with regular expression search and replace. What have you tried so far? – Daniel Beck Jul 5 '13 at 6:14
  • i have big list and like do that Find What: ^.?(.*) Replace with: \1 Search Mode Regular expression that remove first character but i need remove last character – user235867 Jul 5 '13 at 6:22
  • 1
    Why are you trying to do this in Notepad++ specifically? – Andrew Lott Jul 5 '13 at 7:20



This means

^ start from the beginning of the line
(.*) get as many any characters, put in \1
. one more character
$ end of the line

Because we need "one more character", the first grab can't get everything, so is left with the whole line except one character. Then we replace with \1.

You could also simply replace .$ with nothing

  • 3
    You could also simply replace .$ with nothing. – Bob Jul 5 '13 at 7:07
  • @Bob - not sure why you didn't just enhance the answer, so I did it for you. – Paul Jul 5 '13 at 10:11
  • The ".$" will also match the "form feed" character 0x0C as end of line and will delete a character before it. How to avoid that? – Eiver Jul 2 '14 at 9:21
  • @Eiver The OP wants to delete the character before the end of line. What do you want to do? If this deleted an \f that you wanted to replace, then use \1\f in the replace statement. – Paul Jul 2 '14 at 10:43

Should be possible to do this with a macro as well.

Macro->Start Recording

"End" key->"Back(space)" key->"Down Arrow" key->"Home" key

Macro->Stop Recording

Macro->Run Macro Multiple Times.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.