Search code examples
notepad++

Add text after the first instance of a word (notepad++)


I have a list of phrases like this

Mike is Russia, He is 28 y.o.
Elena is UK, She is 30 y.o.

and I want to add a "from" after the first "is" and not the second "is" so it becomes:

Mike is from Russia, He is 28 y.o.
Elena is from UK, She is 30 y.o.

Solution

  • In Notepad++, in find and replace, use search mode Regular expression, in Find use (^.*?(is)) and in Replace \1 from

    This regular expression find from start of line to first 'is' occurred and then append found text with 'from'