Welcome aboard! We are happy you are here and wish you good net-raft!
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div></div><p></p>
<div></div>
<script>
var old_string = 'I love typescript!';
var new_string = 'I love typescript!';
var regex_string = 'type';
var re = RegExp(regex_string, 'gi');
var a = new_string.replace(re, 'java');
document.getElementsByTagName('div')[0].innerHTML = old_string;
document.getElementsByTagName('div')[1].innerHTML = a;
</script>
</body>
</html>
The most helpful JAVASCRIPT solutions