I'm looking for a python module that would help to test if a string is in a list of formatted string. I can't find the exact words to explain my problem (that's probably why I didn't find anything) so here is an example :
REGISTERED_KEYS = (
'super_key',
'key_ending_with_anything_*',
'anything'
)
is_key_registered("super_key", REGISTERED_KEYS)
>> True
is_key_registered("wrong_key", REGISTERED_KEYS)
>> False
is_key_registered("key_ending_with_anything_foobar", REGISTERED_KEYS)
>> True
The thing is not to simply check if a string is in a list but it's also to allow string formatting. I may have to use regexp but I wanted to know if there's an existing module that does this (as it seems to be a common need). Edit : the format of my REGISTERED_KEYS doesn't have to me the one I've written. Can be regex.
Thanks