Ask Ben: Javascript String Replace Method

alert( strText.replace( new RegExp( "th", "gi" ), RandomString ) );

For Cut-and-Paste