Requirement:using regex want to fetch only specific strings i.e. string betwee "-" and "*" symbols from input list. Below is the code snippet
ZTon = ['one-- and preferably only one --obvious', " Hello World", 'Now is better than never.', 'Although never is often better than *right* now.']
ZTon = [ line.strip() for line in ZTon]
print (ZTon)
r = re.compile(".^--")
portion = list(filter(r.match, ZTon)) # Read Note
print (portion)
Expected response:
['and preferably only one','right']
strip().