# How to apply substitution when expression contains powers of the quanity

An expression like:

a = TrigToExp[ 3 + 4 Cos[u] + Cos[ 2 u]]


produces a list of exponential factors:

3 + 2 E^(-I u) + 2 E^(I u) + 1/2 E^(-2 I u) + 1/2 E^(2 I u)

How would I make a substitution of E^(I u) -> z in this? If I try that, it does only the first power portion:

a /. E^(I u) -> z


3 + 2 E^(-I u) + 1/2 E^(-2 I u) + 1/2 E^(2 I u) + 2 z

I also tried:

a /. E^(m_ I u ) ->  z^m


but this didn't work (at all, not making a single substitution).

a = TrigToExp[3 + 4 Cos[u] + Cos[2 u]]


3 + 2/E^(I*u) + 2*E^(I*u) + 1/2/E^(2*I*u) + (1/2)*E^(2*I*u)

b = a /. u -> Log[z]/I // Simplify


(1 + z)^4/(2*z^2)

(b /. z -> E^(I*u)) == a // Simplify


True