tried find in network without success..
let's have following string:
this string test lot of string words here string string there string here string.
i need replace first 'string' 'anotherstring' after first 'here', output be:
this string test lot of string words here anotherstring string there string here string.
thank help!
you don't need add g modifier while replacing first occurance.
str.replace(/\b(here\b.*?)\bstring\b/, "$1anotherstring");
Comments
Post a Comment