Neo4j match array value with node property

425 Views Asked by At

I am trying with this query

MATCH(u:User) WHERE ANY(name IN ['ACB','xYz'] WHERE u.first_name =~ "(?i).*name.*") RETURN u

it is considering (?i).*name.* as static text instead of dynamic value from name IN ['ACB','xYz'].

1

There are 1 best solutions below

0
Stefan Armbruster On BEST ANSWER

You can assemble a regex expression using string concatenation. This case however needs some toString hinting:

MATCH(u:User) WHERE ANY(name IN ['ACB','xYz'] 
    WHERE u.first_name =~ toString("(?i).*" +name +".*")) 
RETURN u