Regex replacing word within string beginning with specific word (Notepad++) -


i want replace each occurrence of specific word, has in line begins word.

example text:

this random text here

that random text here

i want select lines beginning "this" , change "text" e.g. "word".

result of fin&replace in notepad++ be:

this random word here

that random text here

so far, able select line, no problem there: (this.+) problem how search , replace word "text", since can't group/sub-pattern work within itself, using \1.

i able select string , word, can't figure out how search within line found. i'm regex rookie, have patience. :)

many sharing brilliant thoughts!

^this\b.*?\k\btext\b 

try this.replace word.see demo.

https://regex101.com/r/jv9ov2/9

or

^(this\b.*?)\btext\b 

replace \1.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -