regexcloudantaccent-insensitive

How I can ignore accent sensitive when I use a regex query in Cloudant Query?


Please help me to ignore accent sensitive in a Cloudant Query

I found on the internet a method to ignore case sensitive (?i), it works fine. But doesn't work with accent sensitive.

This is a part of my Cloudant Query:

{
  "modelo": { 
     "$regex": "(?i)sábado" 
   }
}

Thanks!!


Solution

  • I found the solution: Just have to change any vowel in the string you want to search for the respective vowel.

    var dat = "sábado"
    var res = dat.replace(new RegExp(/[aáAÁ]/g), "[aáAÁ]");