stringObj.replace(rgExp, replaceText)ArgumentsstringObj
Required. The String object or string literal on which to perform the replacement. This string is not modified by the replace method. rgExp
Required. An instance of a Regular Expression object containing the regular expression pattern and applicable flags. Can also be a String object or literal. If rgExp is not an instance of a Regular Expression object, it is converted to a string, and an exact search is made for the results; no attempt is made to convert the string into a regular expression. replaceText
Required. A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. In JScript 5.5 or later, the replaceText argument can also be a function that returns the replacement text.
Required. The String object or string literal on which to perform the replacement. This string is not modified by the replace method. rgExp
Required. An instance of a Regular Expression object containing the regular expression pattern and applicable flags. Can also be a String object or literal. If rgExp is not an instance of a Regular Expression object, it is converted to a string, and an exact search is made for the results; no attempt is made to convert the string into a regular expression. replaceText
Required. A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. In JScript 5.5 or later, the replaceText argument can also be a function that returns the replacement text.
var stringA = "abcdefg";
var stringB = stringA.replace("abc","0");
alert(stringA + "\n" + stringB);