JSFiddle - React, Tailwind, and code Playground

by Waqas Memon

HTML

<!DOCTYPE html>
<html>
<body>

<p>Click the button to do a global search and replace for "is" in a string.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
  var str = 'Is this "3" dris "3"?';
  var allvar= '"3"';
  var patt1 = new RegExp( allvar, 'g' );
  document.getElementById("demo").innerHTML = str.replace(patt1,'"5"');
}
</script>

</body>
</html>