The problem is the use of .+
- they are "greedy", meaning they will consume as much input as possible and still match.
Change them to reluctant quantifiers: .+?
, which won't skip forward over the end of the first match to match the end if the last match.