How to pass parameter with regex query

Hello all,

I am trying to query using regular expression in py2neo. However, I ran this query, but It did not work. I tried running the same query directly in Cypher and it worked. I do not know what I am missing.

I appreciate any help.

Thanks.
Bader


            propertyNode = tx.run("MATCH (n) WHERE n.name=~(?i)$x(s?) RETURN n.id, labels(n)", x=word).data()

Have you tried:

propertyNode = tx.run("MATCH (n) WHERE n.name=~'(?i)' + $x +'(s?)' RETURN n.id, labels(n)", x=word).data()

It did not work either. I want to match keywords like cartype or carType.

What are you using (s?) for?

This actually works:

return "carType"=~ '(?i)' + "car" + '\S+'