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
Post a Comment