javascript String replace( )
| replace( ) | NN 4 IE 4 ECMA 3 |
|
replace(regexpression, replaceString) |
|
|
Returns the new string that results when matches of the regexpression parameter are replaced by the replaceString parameter. The original string is unharmed in the process, so you need to capture the returned value in a variable to preserve the changes. |
|
| Parameters | |
|
|
| Returned Value | |
|
A string. |
|
Example
var str = 'abCdc';
str = str.replace(/c/ig,'1');
// abCdc -> ab1d1
Previous: javascript String search( )
1789,Nickname,Homepage or email,Comments here,Add comment
