I have something like:
Some MY_WORD stupid txt='other text MY_WORD' and another MY_WORD stupid text and txt='something else MY_WORD' and also txt='here nothing to replace' and here txt='again to replace MY_WORD here'
I want to replace MY_WORD
with OTHER_WORD
but only if it is inside txt='
and '
/(?<=txt='.*)MY_WORD(?=.*')/g
Some MY_WORD stupid txt='other text OTHER_WORD' and another MY_WORD stupid text and txt='something else OTHER_WORD' and also txt='here nothing to replace' and hexe txt='again to replace OTHER_WORD here'
But look behind is not supported in all browsers, so it is not good approach.
A tried with this but even it says there are groups of matches, I $3 is empty.
(txt=')((.*)(MY_WORD))?