I use indexOf to check if a string contains a given text. But this is case sensitive and also sensitive to accents.
Would there be any way for me to find these records in the case of entering any of the following in the search:
- joao
- Joao
- jOao
- joão
- John
I imagine that with regular expression I could achieve, but I do not understand very well how they work. Especially when it comes to a variable.
My code looks like this:
var textoBusca = $("#campoBusca").val();
if(meuTexto.indexOf(textoBusca) != -1){
alert("Foram encontrados registros");
}