Input: 'text __city__ text __city__ text __city__'
Output: 'text <i>city</i> text <i>city</i> text <i>city</i>'
The result of the feature is passed into dangerouslySetInnerHTML.
This component is
<div dangerouslySetInnerHTML={{__html: content.replace(/(?:\r\n|\r|\n)/g, '<br />')}}></div>
for this problem (link).
My function is
const transformText = (text) => {
  const tmp = text.split('__');
  var res = '';
  var check = true;
  for (var i = 0; i < tmp.length-1; i++){
    check = !check;
    if (check) {
      res += '<i>'+tmp[i]+'</i>';
    } else if (tmp[i] != undefined){
      res += tmp[i];
    }
  }
  return res;
};
but breaks the rest of the page into IE11 browser.
 
    