User Portlet User Portlet

Discussions
This works and may be educational, but also ineffective for large lists (may be a bit over-spec, actually, depending on your input format): [mcode]lst //. {a___, Longest[PatternSequence[db, id_, nums : _?NumberQ .., de]], c___} :> {a, {id, #}...
Some more WS: Stand, und Undo yourself! There is also this: http://undo-for-mathematica.alaifari.com/   (no need to mention but: yes, please!)