I am trying to grep two kinds of patterns in a list using re in python:
'<xyz>number followed by optional *</xyz>'
'name="namepad">number</xyz>
Using regex in python, I am not able to get the data with asterisk. Here is a sample session, what can I do so that the filter also returns the first element?
>>> k = ['<xyz>27*</xyz>', 'name="namePad">22</xyz>']
>>> f = filter(lambda x:re.search('^name="namePad"|^<xyz>[0-9]{1,3}\*" <\/xyz>',x), k)
>>> f
['name="namePad">22</xyz>']