Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling special chars in a case insensitive search

Tags:

neo4j

cypher

I am using:

c.customerName =~ '(?i).*$q.*' 

in order to find insensitive case any kind of customername and this is working absolutely fine for all standard character. In German unfortunately there are special chars e.g. like Ä,Ö,Ü. In this cases the cypher statement is case sensitive, e.g. if we have two customer names like Ötest and ötest it will find only one of them depending if you type a lower or an upper Ö.

Anyone has a hint what I can do to expand the insensitive case search also on such special chars?

EDIT: The problem exists also when you have a name including e.g. a '&' - you'll find e.g. the company D&A Construction when you type 'D&' - the moment you add a thrid character 'D&A' the search fails and no result is shown. Any idea?

like image 270
Balael Avatar asked Dec 11 '25 02:12

Balael


1 Answers

You need to add a 'u' in your regex to transform it in a case-insensitive unicode regex. Like this:

c.customerName =~ '(?ui).*$q.*'

Works here:

enter image description here

From this StackOverflow question.

like image 58
Bruno Peres Avatar answered Dec 13 '25 22:12

Bruno Peres



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!