Fri, 17 May 2024


How to use the JavaScript regular expression replace method?

By: Peter, NetArt Media
Mon, 17 August 2020

myString = "javascript, 'JAVASCRIPT', JavaScript";
document.write(myString+"<br><br>");


myString=myString.replace(/javascript/ig, "---''$1''---");
document.write(myString);
myString.replace(/^.*\'([^\']*)\'.*$/, "---''$1''---")


Category: Javascript
Share this post:



See All Scripts






Subscribe for our newsletter

Receive the latest blog posts direct in your mailbox