Javascript - String.replace()

Syntax

string.replace(regexpression, replacestring)

Description

The replace() method of an instance of the String object searches the string in which it is invoked for the regular expression passed to the method. The regular expression is made up of a pattern and flags that dictate what is to be matched. If and when a match is found, the method returns a new string with that match replaced with the replacement string passed to the method.

Example

<script language="JavaScript">
<!--

var myString = new String("Hello today");
var myRegExp = /today/g;

document.write(myString.replace(myRegExp, "tomorrow")); //result is 'Hello tomorrow''
//--> </script>
Write a review
Message:
Rating:
Name:
Email:
(optional)
(Your email that entered here will not show anywhere on website and will use only reference when someone reply your post)
  I want to receive a copy of email on this post (your email is needed)
 
Code: