Integral Change of Variable Limits

$$\int_{-\infty}^{\infty} \frac{dx}{x^2}(1-e^{-ax^2}) = 2\sqrt{\pi a} = \int_{-\infty}^{\infty} (1 - e^{-a/x^2})\,dx$$

Those two integrals are the same (check on Wolfram Alpha). Now, how do we get the integration limits on the LHS, i.e. how do we go from the RHS integral to the LHS integral? I would have thought the limits would go from (+/-)infinity to (+/-)1/infinity = 0_+/0_-, but apparently they don't.

For reference this is finding the strong line limit equivalent width of a spectral line, if any of you have tackled this problem before, and the hint we are given is the integral on the LHS, which we are meant to get from the RHS integral.

Thanks

Firstly, your integrand is symmetric about zero and so it is ok to write $$\displaystyle\int_{-\infty}^{\infty} \left(1-e^{-ax^2} \right)\dfrac{\mathrm{d}x}{x^2} = 2 \displaystyle\int_0^{\infty} \left(1-e^{-ax^2} \right) \dfrac{\mathrm{d}x}{x^2}$$ and $$\displaystyle\int_{-\infty}^{\infty} \left(1-e^{-\frac{a}{u^2}}\right) \mathrm{d}u=2 \displaystyle\int_0^{\infty} \left(1-e^{-\frac{a}{u^2}}\right) \mathrm{d}u.$$
At zero itself, the integrand has a removable singularity (L'Hopital's rule shows the limit as $x$ approaches $0$ is equal to $0$) so the integral is not improper there. Let $u=\dfrac{1}{x}$ so $\mathrm{d}u = -\dfrac{\mathrm{d}x}{x^2}$ and $x^2=\dfrac{1}{u^2}$. We understand that if $x=0$, then $u=\infty$ and if $x=\infty$ then $u=0$. This allows us to write \begin{eqnarray*} 2 \displaystyle\int_0^{\infty} \left(1-e^{-ax^2} \right) \dfrac{\mathrm{d}x}{x^2}&=-2 \displaystyle\int_{\infty}^0 \left(1 - e^{-\frac{a}{u^2}} \right) \mathrm{d}u \\ &=2 \displaystyle\int_{0}^{\infty} \left(1 - e^{-\frac{a}{u^2}} \right) \mathrm{d}u \\ &=\displaystyle\int_{-\infty}^{\infty} \left(1-e^{-\frac{a}{u^2}}\right) \mathrm{d}u, \end{eqnarray*} as was to be shown.
As for why this substitution doesn't work in the original integral -- that would require $u=\dfrac{1}{x}$ to be differentiable over the domain (of $x$-values) $\mathbb{R}=(-\infty,\infty)$, but it is not even continuous at $x=0$.