I am using the following regular expression for a filter of an application that connects to a MongoDB database:
{"$regex": re.compile(r'\b' + re.escape(value) + r'\b', re.IGNORECASE | re.UNICODE)}
The regular expression meets my search criteria however I have a problem and that is that it does not ignore accents. For example:
The database entry is: "Escobar, el patrón del mal Colombia historia".
And I search for "El patron".
I do not get any result because the "accent" in the letter O does not let me fetch the record. How can I fix it? I thought that with the re.UNICODE part I would ignore this.