I knew how to do that based on LOTS of study and practice with Mathematica patterns. Look at FullForm[yourexpression] to see what it is without Mathematica trying to hide behind the gui interface. Then experiment with patterns that match the structure of what you see in that FullForm output. With that hint and enough study and practice and failure and patience you too can start to get the hang of patterns in Mathematica
URL: ,
Subject (listing for 'Collecting terms in an expression')