I am having some problems retrieving the real part of a complex function. I have a function which looks as follows:

$ $ 2^{-\dfrac{4\left( \frac{x}{\sqrt{2}}+\frac{z}{\sqrt{2}} \right)^{2}}{w^2} } e^{-i\left(\dfrac{k x}{\sqrt{2}}-\dfrac{k z}{\sqrt{2}} +\phi+\omega t \right)} $ $

Basically, I am only interested in the real part of this function. Thus the complex exponential part would turn into a Cosine function with the same argument. However, if I apply the $ Re[\ ]$ operator onto this function I get:

$ $ Re[2^{-\dfrac{4\left( \frac{x}{\sqrt{2}}+\frac{z}{\sqrt{2}} \right)^{2}}{w^2} } e^{-i\left(\dfrac{k x}{\sqrt{2}}-\dfrac{k z}{\sqrt{2}} +\phi+\omega t \right)} ] $ $

I understand that I could just manually replace the complex exponential with a cosine but that would not be functional for my calculation program. Is there any way in which I can do this consistently and automatically?