I have two lists of strings in Python. One of them is a list of desired strings, the other is a larger list of different strings. For example:
desired = ["cat52", "dog64"]
buf = ["horse101", "elephant5", "dog64", "mouse90", "cat52"]
I need a True/False for whether the second list contains all the strings in the first list. So far I did this with:
if all(element in buf for element in desired)
However, now I need the list of desired strings to have some regex properties. For example:
desired = ["cat52", "dog[0-9]+"]
I've looked into the re and regex python libraries but I can't figure out a statement that gives me what I want. Any help would be appreciated.
bufcontains all the strings indesired. So in the above example it would return true, asbufhas "cat52" and "dog64", and they match the desired listdesired = ["cat52", "dog[0-9]+"]