I need to add a trailing thxt to lines, but only to lines which begins with a specific text.
Example:
AAA First Line text
BBB Second line text
I need to add the trailing text only to lines which begins with BBB, so, supposing to add "with trailing text", the final result will be:
AAA First Line text
BBB Second line text with trailing text
Any idea about how to obtain this?
Tried with some regular expression and substitution, but I can't find a way to impose the condition that only lines beginnig with something specific will get the trailing text
In Notepad++ on the Replace dialog you need to click the Regular Expression radio button at the bottom right. Then you can:
^(BBB.*)$
\1 with trailing text
How that works is:
^...$
means the entire line instead of just part of it(...)
means capture this text as \1
BBB.*
means BBB followed by 0 or more of any character\1
means replace this with whatever was captured earlier