# How to make this particular replacement involving exp

I apologize if similar questions have already been asked, but I have some difficulties with replacements in Mathematica and I would like to make a substitution like

Exp[I m phiA] --> f[m,phiA]
Exp[I m phiB] --> f[m,phiB]


where m is a number and phiA,phiB are variables, in expressions that contain sums in the exponent, e.g.

2 + Exp[-2 I (phiA + phiB)] + Exp[2 I phiA + 2 I phiB]


which should give

1/4 + f[-2,phiA] f[-2,phiB] + f[2,phiA] f[2,phiB]


Is this possible? How can it be done?

-
Lookk at a related question: HornerForm of polynomials in terms of E^(i x). –  Artes Dec 3 '13 at 17:11
I managed to replace the form Exp[m I phi] using Complex. How can I transform Exp[-2 I (phiA + phiB)] to a product of elements like Exp[m I phi]? –  Pincopallino Dec 3 '13 at 18:03
E.g. Exp[-2 I (phiA + phiB)] /. Exp[a_ (b_ + c_)] :> HoldForm[Exp[a b] Exp[a c]]. –  Artes Dec 3 '13 at 18:08
Oh thanks! Can it be generalized to sums with an arbitrary number of addends? –  Pincopallino Dec 3 '13 at 18:45