in reply to get the string upto word containing tag block

Is this what you looking for, my ($output)=$str=~m{(.*?</w:t>)}ms;