Q:

Replacing text globally with line break in React Native/Javascript

I want to replace an xml tag <Add with \n<Add so that it open a new line for every <Add.
However I tried .replace(/\<Add/g, '\n') It shows a blank screen.
I also tried replace it once .replace('\<Add', '\n') It works with the first <Add replaced by line break. But I need to reaplce all <Add with a line break...
Why I can't replace text with "\n" globally? How can I do it in react native?

A:

Considering:
.replace('\<Add', '\n')

Works for the first, but not others, do the replacement using the global flag:
.replace(/(<Add)/g, '\n$1')

