I've searched around and found things that could help me only in cases that are simpler than the one I had in mind. I would like to extract polynomials from expressions that schematically look like
$$\mathrm{e}^{q(h+\overline{h})}p(h,\overline{h},Q,\overline{Q})$$
where $q$ and $p$ are polynomials. I want to extract $p$. In practice, however, these things look substantially more complex. Here's several such examples, first in TeX and then in code. What I'm trying to do is write a function that obtains the rightmost parenthetical expression in each case.:
$$4 \pi ^2 e^{-i \theta } \left(e^{2 i \pi e^{i \theta }}\right)^h \left(e^{-2 i \pi e^{-i \theta }}\right)^{\text{hbar}} \left(\text{hbar} Q+e^{i \theta } h \text{Qbar}\right),$$
$$2 \pi e^{-3 i \theta } \left(e^{2 i \pi e^{i \theta }}\right)^h \left(e^{-2 i \pi e^{-i \theta }}\right)^{\text{hbar}} \left(-4 i \pi ^2 e^{5 i \theta } h^2 Q-2 \pi e^{4 i \theta } h Q-4 i \pi ^2 \text{hbar}^2 \text{Qbar}+6 \pi e^{i \theta } \text{hbar} \text{Qbar}+i e^{2 i \theta } \text{Qbar}\right),$$
$$2 i \pi e^{-i \theta } \left(e^{2 i \pi e^{i \theta }}\right)^h \left(e^{-2 i \pi e^{-i \theta }}\right)^{\text{hbar}} \left(\text{Qbar}+e^{i \theta } Q\right),-2 \pi e^{-2 i \theta } \left(e^{2 i \pi e^{i \theta }}\right)^h \left(e^{-2 i \pi e^{-i \theta }}\right)^{\text{hbar}} \left(2 \pi e^{3 i \theta } h Q+2 \pi \text{hbar} \text{Qbar}+i e^{i \theta } \text{Qbar}\right)$$
{2 I E^(-I θ) (E^(-2 I E^(-I θ) π))^
hbar (E^(2 I E^(I θ) π))^
h π (E^(I θ) Q +
Qbar), -2 E^(-2 I θ) (E^(-2 I E^(-I θ) π))^
hbar (E^(2 I E^(I θ) π))^
h π (2 E^(3 I θ) h π Q + I E^(I θ) Qbar +
2 hbar π Qbar),
2 E^(-3 I θ) (E^(-2 I E^(-I θ) π))^
hbar (E^(2 I E^(I θ) π))^
h π (-2 E^(4 I θ) h π Q -
4 I E^(5 I θ) h^2 π^2 Q + I E^(2 I θ) Qbar +
6 E^(I θ) hbar π Qbar - 4 I hbar^2 π^2 Qbar),
4 E^(-I θ) (E^(-2 I E^(-I θ) π))^
hbar (E^(2 I E^(I θ) π))^
h π^2 (hbar Q + E^(I θ) h Qbar)}
Any help would be greatly appreciated. Thanks!