-2

I have a bunch of code with from time to time this pattern in my script:

Write-Output " * + Some Text1"; LOGUJ "+ Some Text1"
Write-Output " * + Some Text2"; LOGUJ "+ Some Text2"
Write-Output " * + Some Text3"; LOGUJ "+ Some Text3"
[...]
Write-Output " * + Some Textn"; LOGUJ "+ Some Textn"

What I need to do is replace center of it to:

LOGOUTPUT "+ Some Text1"
LOGOUTPUT "+ Some Text2"
LOGOUTPUT "+ Some Text3"
[...]
LOGOUTPUT "+ Some Textn"

Basically I have the same pattern - need to always replace everything from word: "Write-Output" until word "LOGUJ" with one the same word: "LOGOUTPUT".

Its can be done with NP++, or maybe other tools are clever to do this? :)

MikeZetPL
  • 97
  • 5
  • This can definitely be done with the regex option in the find/replace tool. This question should give you a good idea of how to format an expression that would select the correct text: [Regular expression - starting and ending with a character string](https://stackoverflow.com/questions/18024298/regular-expression-starting-and-ending-with-a-character-string) – DBS May 15 '23 at 16:09
  • That should be simple in Notepad++. What have you tried and what were the results? Also, please [edit] the question show the wanted output for the example input text. – AdrianHHH May 15 '23 at 16:09

1 Answers1

0

Thanks for all comments. I found it with bellow replacement code in NP++

Write-Output.*?LOGUJ

with set as "Regular expression"

enter image description here

MikeZetPL
  • 97
  • 5