Select syntax pretty useful

Sean Hinde Sean.Hinde@REDACTED
Wed Oct 17 19:31:10 CEST 2001

I just made a nice discovery (undocumented from what I can make out)

If you have an ets table and want to retrieve strings which start with a
certain prefix you can do:

1>E=ets:new(sean, [bag]).
2>ets:insert(E, [{sean, "sean", 1}, {sean, "bean", 2}]).
4>ets:select(E, [{{sean, A++'_', '_'},[],['$_']}]).
[{sean, "sean", 1}]

This is pretty nice, and it means we can do our current app without needing
some bloated expensive RDBMS product :-)

My thanks to the R8 team,


This email (including attachments) is confidential.  If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents.  We cannot accept liability for any breaches of
confidence arising through use of email.  Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions.  We will not accept responsibility for any commitments
made by our employees outside the scope of our business.  We do not warrant
the accuracy or completeness of such information.

More information about the erlang-questions mailing list