To start off, I want to be able to do 2 things:
1st Thing:
To extract foo_abc (and similarly every other line, for example, goo_zxy, and doo_fgh), I needed to remove some text appended BEFORE foo_abc, and AFTER foo_abc.
For example:
TEXTBEFOREfoo_abcTEXTAFTER
TEXTBEFOREgoo_zxyTEXTAFTER
TEXTBEFOREdoo_fghTEXTAFTER
to obtain:
foo_abc
goo_zxy
doo_fgh
2nd Thing:
I now need to append different text before and after foo_abc again. Like so:
TextAfoo_abcTextB
So what I've done is:
Find: ^
Replace: TextA
Find: $
Replace: TextB
Which works well, but I have to perform a find&replace TWICE which is not very efficient. To avoid that, I found this: Multiple word search and replace in notepad++
And applied it like so:
Find: (^)|($)
Replace: (?1TextA)(?2TextB)
But it doesn't work out too well.
AND, as mentioned, I need this to work for EACH and every line: For example:
foo_abc
goo_zxy
doo_fgh
I need to insert TextA at the beginning for each of those lines, and TextB at the end of each line, like so:
TextAfoo_abcTextB
TextAgoo_zxyTextB
TextAdoo_fghTextB
Can this be done? (Yes, I actually need to do this to over 10000 lines, not just 3 and wanting an efficient way to do so).
Have I missed a quicker way to do all of this? Perhaps by performing a search and replace above in '1st Thing' on the TEXTBEFORE and TEXTAFTER, with TextA and TextB, respectively, in one-go?
Many thanks.
EDIT: Yes, they are literal strings. Yes, they do contain special characters because they are represent parts of a URL.
TEXTBEFORE
andTEXTAFTER
literal strings? Try^(TEXTBEFORE)|TEXTAFTER$
and replace with(?{1}TextA:TextB)
foo_abc
allways 3 lowercase letters, underscore, 3 lowercase letters?