Again recognizing that this is similar to a few other questions on SO but which I haven't been able to convert for my purposes. eg. with the snippet below
import re
a = ['rhubarb','plain custard','jam','vanilla custard','pie','cheesecake']
s = re.compile('custard')
I'd like to be able to get a list
[2,4]
which is the index of the two custard
strings. I thought the question below would help but I haven't been able to figure out how to apply it here.