rearranging symbolic variables

*To*: mathgroup at smc.vnet.net*Subject*: [mg128315] rearranging symbolic variables*From*: yajnaval at gmail.com*Date*: Sat, 6 Oct 2012 01:51:32 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-newout@smc.vnet.net*Delivered-to*: mathgroup-newsend@smc.vnet.net

I have a group of symbolic variables that look like this phi_1.phi_3.phi_1.phi_2 + phi_2.phi_1.phi_1.phi1 + ..... Need to rearrange the above expression such that all the (phi_1)s are on the left and all (phi_2)s are to right side of (phi_1)s but to the left of (phi_3)s i.e. REWRITE the above as phi_1.phi_1.phi_2.phi_3 + phi_1.phi_1.phi_1.phi_2 + .... The dots may not be necessarily multiplication, they may be just strings with a certain combination of (phi_1)s and (phi_2)s in a certain order, to be ordered in a given way. Any help is appreciated.