How to search list items by regex with Aerospike Expressions


We have a bin with a string-list in it. And we want to do a search with a “matches” pattern on a List String element. In the old world, we do that with following code:

as.NewPredExpStringValue("^.*"+regexp.QuoteMeta("search_term") + "".*"),

But with the new Aerospike Expressions this is what we tried so far without success…

    as. ExpListBin("ListField"),

Please Advise.

I do see that a Contains Aerospike Exrpression is easy to achieve with the List bin type, but Regexp matching not working, is it not supported or is something my team is missing.


I haven’t carefully read your question but in the meantime, Java Filter Expression Range Filter not working - #4 by pgupta please take a look at this link and see if it helps.

thanks @pgupta Our case is a regexp match on at least one element of bin of type List the link shared does not cover that

When it comes to list data type, you can only match by starting with the first element and not any element within the list – in CDTs - you cannot iterate through the elements presently. This is another post on how match starting element in lists. Searching for the index of specific AAID - #2 by pgupta

static Exp regexCompare(String regex, int flags, Exp bin)

Create expression that performs a regex match on a string bin or string value expression.

regexCompare does not support matching on a list bin’s values.

You can certainly search for a specific string value in the list of string values. i.e. if your list has ["jack", "john", "sally", "bill" ] … you can find if the list contains exact match string for e.g. "sally".

I see, @pgupta thx for confirming