Hi,
To use a case insensitive search() function in Javascript with variable, you have to use a RegExp object. In RegExp, you can make the pattern and set case insensitive search:
<script>
function addLink(content, variable){
var p = new RegExp("(?!\\s)" + variable, 'i');
var v = content.replace(p, "<a href='https://www.example.com' target='_blank' >"+ content.substr(content.search(p), variable.length) +"</a>");
return v;
}
var c = addLink('Microsoft Office Home & Business inlcudes Outlook', 'outlook');
alert(c);
</script>