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

Using found text in replace text

I want to add a new line before a date and the dates change so I use . to match 28/06/2023 -> ../../2023.
I would like to still get \n28/06/2023 in the end result.

So my question is if you in Notepad++ can use the found text in the replacement text when using regex?
Or if it is possible not to replace and just add a new line before the date?

Replace

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

>Solution :

Use capture group:

  • Find what: \d\d/\d\d/2023
  • Replace with: \n$0

Where $0 contains the whole match.

Another way is to use lookahead:

  • Find what: (?=\d\d/\d\d/2023)
  • Replace with: \n
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