How to search a key pattern in redis hash?

Viewed 15251

I have a hash table whose keys are of pattern USER_TEL like:

bob_123456  : Some address
mary_567894 : other address
john_123456 : third address

Now, I'd like to get addresses of all uses who have the same TEL in their keys.

What I came up with is:

tel = 123456
r.hmget('address_book', '*_%s' % tel)

I get [None] instead of the values.

1 Answers
Related