Does anyone have a solution for a case-insensitive replacing function in JavaScript? For instance, if I want to replace 'is' with 'as', it should work similar to this:
'This iS IIS'.replaceAll('is', 'as');
The expected result would be:
'Thas as Ias'
Any suggestions on how to achieve this?
UPDATE:
I would like to be able to use a variable in the replacement process. For example:
var searchStr = 'is';
'This iS IIS'.replaceAll(searchStr, 'as');