$string =~ s/(traderid)(.*?)(traderid)/${1}myword${3}/s; [download]
In reply to Re: Replacing exactly the found instance in REGEX by JavaFan in thread Replacing exactly the found instance in REGEX by inquis