0

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

Ashton
  • 35
  • 5

2 Answers2

1

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
Toto
  • 89,455
  • 62
  • 89
  • 125
1

I'm using this website and this stackoverflow answer:

I believe what you're looking for would be:

Search: ../../2023

Replace: \n$&

Let me know if this works :)

Borisonekenobi
  • 469
  • 4
  • 15