For cleaning up this type of hideous code, I have personally began using the Calibre Editor with DiapDealer's "Editing Toolbag":
https://www.mobileread.com/forums/sho...d.php?t=251365
This Plugin is more intelligent (can handle hideously nested spans) compared to just a Regex cleanup.
These are the settings I would use:
Just a single run with the above settings would have cleaned up your initial example to this:
Then it becomes much easier to focus on reading the code and clean up the rest.