Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

277
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!