Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Notepad++ Insert a character before the last three characters in every line

Is it possible and how do I insert a character before the last three characters in every line?

For example, I have something like this:

5.400
830
400
1.740
1.000
2.600
310
2.280
830
520
4.650
1.450
930
5.000

And I need it like this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

5.#400
#830
#400
1.#740
1.#000
2.#600
#310
2.#280
#830
#520
4.#650
1.#450
#930
5.#000

>Solution :

  • Ctrl+H
  • Find what: (?=...$)
  • Replace with: #
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline
  • Replace all

Explanation:

(?=     # positive lookahead, make sure we have after:
    ...     # 3 any character but newline
    $       # end of line
)       # end lookahead

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading