Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

281
Visualizações
How to remove case sensitivity from email in js

I want to remove the case sensitivity from emails when searching emails. For further explanation, If I search an email(dmc@gmail.com) in a different ways like this 'DMC@gmail.com' or 'dMc@gmail.com' or 'Dmc@gmail.com'. I want to retrieve the email. If anyone can help, really appreciated.

Thank you

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

Just use toLowerCase() in js and you'r done.

let text0 = "abc@gmail.com";
let text1 = "aBc@gmail.com";
let text2 = "ABC@gmail.com";

text0 = text0.toLowerCase();
text1 = text1.toLowerCase();
text2 = text2.toLowerCase();


console.log(text0, text1, text2)

about 4 years ago · Juan Pablo Isaza Relatório

0

In order to achieve that you could get the text value from the search input and transform it to lowercase before executing the search, you can do that in JS with the method [yourText].toLowerCase()

Example:

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript String to lowercase</h1>

<input id="your-input" type="text">

<button onclick="convertText()">To lowercase!</button>

<p id="demo"></p>

<script>
function convertText() {
let text = document.getElementById("your-input").value;
document.getElementById("demo").innerHTML = text.toLowerCase();    
}

</script>

</body>
</html>

about 4 years ago · Juan Pablo Isaza Relatório

0

As pointed out in the comments, this email lookup operation is actually done by querying an Oracle database.

In this case I would suggest to investigate whether it is possible to execute a query containing a case insensitive WHERE clause to filter on the Email column. I'm not an oracle db expert, but usually database systems allow to perform case insensitive queries, by using the proper collation. At least checkig if this is actually allowed is worth the effort.

By doing so you will get the following advantages:

  • the actual computation is done on the database, so you are basically avoiding computation at the application level. Databases are highly optimazed for this kind of work and can leverage indexes to speed up the filtering
  • you will move less data on the network, because only the records which actually match your filter criteria will be transferred over the network to the machine running your application

Another option you can consider, if running a case insensitive query is not supported by your database, is storing the email in a normalized form. You can save both the actual email value (with the original casing) and a normalized version of the email (for instance you can use the email value transformed in uppercase). Then, to perform case insensitive search, you can use the column containing the normalized email value in your WHERE clause. I would suggest to use this approach as a last resort, because you will increase the amount of data stored and you will make your queries less obvious: this is just a workaround to apply when case insensitive queries are not possible.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda