We know that $125 = 5^3$. Substitute this into the equation: $(5)^{x^2+2x+7} = (5^3)^{2x+1}$. Using the power of a power rule $(a^m)^n = a^{mn}$, we get $(5)^{x^2+2x+7} = 5^{3(2x+1)} = 5^{6x+3}$.