The string is stored in a variable text. When I do print(text) I get the output:
SHIP TO
Flensburg House, MMDA Colony,
Arumbakkam,Chennai, Tamil Nadu,
I need to get the text:
Flensburg House, MMDA Colony,
Arumbakkam,Chennai, Tamil Nadu,
Here's what I have tried:
shipto=[]
shipto_re=re.compile(r"SHIP TO((?:.*\n){1,3})")
for line in text.split():
if shipto_re.match(line):
shipto.append(line)
However, this isn't giving me a match,I know the regex works , so the problem definitely lies in how to iterate through the text variable.