Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-08-2021 11:49 AM
I want to modify an existing exact match query that takes a list parameter for filtering
Is there a mechanism to filter based on any of a list of regular expressions:
Something like
WHERE obj.text IN [‘^abc.*’,’.*def$’,’exact’]
Solved! Go to Solution.
07-10-2021 02:42 AM
Hello @dptuck and welcome to the Neo4j community
You can use the any() function to match your regular expressions:
WHERE any(regex IN ['^abc.*', '.*def$', 'exact'] WHERE obj.text =~ regex)
Regards,
Cobra
07-08-2021 10:01 PM
do you have to do it as a list rather than one more complicated regex?
otherwise maybe UNWIND might help you here?
07-09-2021 04:41 AM
Thanks for your reply.
Elements come at runtime from different sources (it's a graphql query) so List would be the easiest, compared to a complicated regex, but will look into other options.
07-10-2021 02:42 AM
Hello @dptuck and welcome to the Neo4j community
You can use the any() function to match your regular expressions:
WHERE any(regex IN ['^abc.*', '.*def$', 'exact'] WHERE obj.text =~ regex)
Regards,
Cobra
07-10-2021 07:12 AM
Thank you, Cobra.
This works perfectly.
All the sessions of the conference are now available online