This forms part of a hobby personal project for developing a knowledge description language.
These the text I want to extract strings:
begin car part chassis engine wheels begin motorbike part
chassis engine wheels begin motorbike part wheels chassis
engine begin tree part roots branches stem leaves begin light
bulb part spile filament crystal begin coin part corp begin pen
part ball pipe button begin glasses part mount
eyeglasses begin motorbike part chassis engine wheels
I think this was the easiest solution to your problem for me.
re.findall(r'begin (\w+)', text) # ['car', 'motorbike', 'motorbike', 'tree', 'light', 'coin', 'pen', 'glasses', 'motorbike']