import re
sentence = ['if', 'it', 'will', 'rain', ',', 'if', 'will', 'stay', 'at', ',', 'home']
s = ' '.join(sentence)
p = re.compile("((\\bif\\b)[a-zA-z0-9\\'\\s]+)\\s*(,*)\\s*(then|,)")
arr = re.findall(p, s)
pos = 0
for i, x in enumerate(arr):
	start = sentence.index(x[1], pos)
	end = sentence.index(x[3], pos)
	stri = ' '.join(sentence[start: end])
	print(stri)
	pos = sentence.index(x[3], pos) + 1