a = 'alpha' b = 'bravo' text = 'from alpha all the way to bravo and beyond.' text.split(a)[-1].split(b)[0] # ' all the way to '