I am trying to see if i can make thsi code more interesting/exciting using list comprehensions. Lets say i have the following lists defined:
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?