I have a large block of text, containing one or more instances of each of a list of words. I need to add a prefix to all instances of each word on the list.
Here's an example of what I'm trying to do -
List of words:
foo
bar
Prefix:
xyz
Text before:
onklnagknaubosabdof foo dklfn fknk foo klnksdnia bar dsknska foo knkn bar
Text after:
onklnagknaubosabdof xyzfoo dklfn fknk xyzfoo klnksdnia xyzbar dsknska xyzfoo knkn xyzbar
How can I do this in Notepad++? Or is there another tool that can do this for me easily?
(?=\b(?:foo|bar)\b)
xyz
Explanation:
Result for given example:
Screen capture:
If you want to replace
foobar
withxyzfooxyzbar
, remove the word boundaries:(?=(?:foo|bar))