I am trying to see if I can make this code better using list comprehensions.
Lets say that I have the following lists:
a_list = ['HELLO','FOO','FO1BAR','ROOBAR','SHOEBAR']regex_list = [lambda x: re.search(r'FOO', x, re.IGNORECASE),lambda x: re.search(r'RO', x, re.IGNORECASE)]
I basically want to add all the elements that do not have any matches in the regex_list
into another list.
E.g. ==>
newlist = []
for each in a_list:for regex in regex_list:if(regex(each) == None):newlist.append(each)
How can I do this using list comprehensions? Is it even possible?