Javascript examples for RegExp:Modifier
Perform a global, case-insensitive replacement:
<!DOCTYPE html> <html> <body> <p id="demo">Blue blue BlUE .</p> <button onclick="myFunction()">Test</button> <script> function myFunction() {//from w w w . j a v a2 s. c o m var str = document.getElementById("demo").innerHTML; var res = str.replace(/blue/gi, "red"); document.getElementById("demo").innerHTML = res; } </script> </body> </html>