You could probably make the first regex use a non-greedy .*
I think that's the simpler approach rather than negative look behind and what not. The same can be applied to many other programming logic problems..useful sometimes to think about chunks of code logic or regex patterns as sets in finite space.
the hardest line to type correctly is: stty erase ^H