Check out example codes for "replace string in typescript". It will help you in understanding the concepts better.
Code Example 1
var re = /apples/gi; var str = "Apples are round, and apples are juicy."; var newstr = str.replace(re, "oranges"); console.log(newstr)
Learn ReactJs, React Native from akashmittal.com