'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:

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


Solution 1:[1]

  • 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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Toto