Учитывая следующий текст:
This is just example text.
Я хочу заменить ...
на \ i ... \ i
, поэтому я попробовал метод replace таким образом.
replace( /(.+)<\/em>/, "\\i$1\\i" )
Но полученный текст:
This \iis just example\i text.
As you can see, it replaced the outer match but left the " just "
in the middle untouched. I want it to replace each occurrance of the match so each instance of ...
gets replace with \i...\i
.