If I have data containing words like Krishna, krishna, KRISHNA and I enter the search text as 'krish', it will retrieve all three words. However, when I want to highlight the matching result, only the exact matching part of the string is highlighted. How can I highlight all matching strings in the given data without considering case sensitivity?
Below is the sample code I implemented:
var searchTxt='KRISH';
var actualTxt='Krish';
if(actualTxt.toLowerCase().indexOf(searchTxt.toLowerCase()){
actualTxt = actualTxt.replaceAll(searchTxt,"<span style='font-weight: bold;background-color: yellow;'>"+searchTxt+"</span>");
}
Please help me with this issue. Thank you in advance.