JavaScript: Direct String Replace Functionality Example

From The Travis van der Font Wiki
Jump to: navigation, search
Since JavaScript's .replace() function depends on Regular Expressions, here is a direct string ONLY example:
'Original test text'.replace(new RegExp('original', 'gi'), 'new');  // Any case match
'original test text'.replace(new RegExp('original', 'i'),  'new');  // EXACT case match