Distribution of Variables I was annoyed the other day when I got a point off in math class because I didn't distribute the factors of my function. 

That is, I put (x+2)(x-3) when I should have put x^2 - x - 6.

Your job is to write a program that takes a string with the expression and convert it to the expanded form so I don't miss future points. 

Rules


Any letters within the lowercase English alphabet can be used as "x" (for example: (a+1)(c+3)).
All exponents in answer must be in the form (variable)^n where n is the power
variables can be assumed to be 1 character long. That is, ab == a * b
Your answer should not contain the "*" character
The spaces before and after a + or - must be present. Otherwise, no spaces are permitted, except for trailing spaces.
You must account for exponents outside of parentheses, so (x+1)^n.


Specifications


You may create a program or function that takes a string parameter 
Your program must output the correct expression to STDOUT or a text file
You may assume that all factors will be surrounded by parentheses. For example, x(x+1) will always be (x)(x+1).
There will never be any other operation besides multiplication between parenthesis. This will never happen: (x)+(x+1).
You may assume there will never be any nested parentheses/exponents.
Order of the resulting expression should be highest exponents first, as per usual math standards. Otherwise, order does not matter.
You may assume single digit exponents
Built in expansion libraries/functions are not allowed, as the comments mention below


Examples

(x+1)(x+2) --&gt; x^2 + 3x + 2
(a)(a-4) --&gt; a^2 - 4a
(c+1)^3 --&gt; c^3 + 3c^2 + 3c  + 1
(a+1)(f-2) --&gt; af - 2a + f - 2
(x-2)(x+4)(x-5)(x+10) --&gt; x^4 + 7x^3 - 48x^2 - 140x + 400
(x+a+c)(b+g) --&gt; xb + xg + ab + ag + cb + cg
(r+4)^2(b) --&gt; br^2 + 8br + 16b


This is code-golf, so shortest program wins!

Bonus

-25 bytes to anyone who makes their program compatible with complex numbers
JavaScript (E6) 834
While waiting for some clarification by OP, I start recycling my answer from  this other question
It's more than what is required here, so it could be golfed more.
I have modified the spacing and added sorting by higher exponent (of any variable).
G=x=&gt;x.replace(/\d/g,n=&gt;' '.repeat(n-2)).length,
K=x=&gt;Object.keys(x).sort((a,b)=&gt;G(b)-G(a)),
A=(p,q,s,t,c)=&gt;[(c=(s+1)*q[t]+~~p[t])?p[t]=c:delete(p[t])for(t in q)],
M=(p,q,t,c,o,u,f,r,v={})=&gt;([A(v,(r={},[(c=p[f]*q[t])&amp;&amp;(r[o={},(u=f+t)&amp;&amp;(u.match(/[a-z]\^?\d*/ig).map(x=&gt;o[x[0]]=~~o[x[0]]+(~~x.slice(2)||1)),K(o,u=k).map(i=&gt;u+=o[i]&gt;1?i+'^'+o[i]:i)),u]=c)for(f in p)],r),k)for(t in q)],v),
E=(p,n)=&gt;--n?M(p,E(p,n)):p,
O=n=&gt;{for(l=0;h(o=s.pop())&gt;=h(n);)a=w.pop(b=w.pop()),o=='*'?a=M(a,b):o&gt;d?a=E(a,b[k]):A(a,b,o),w.push(a);s.push(o,n)},
X=e=&gt;(l=k='',w=[],s=[d='@'],h=o=&gt;'@)+-*^('.indexOf(o),
(e+')').match(/\D|\d+/g).map(t=&gt;(u=h(t))&gt;5?(l&amp;&amp;O('*'),s.push(d)):u&gt;1?O(t):~u?s.pop(s.pop(O(t)),l=1):(l&amp;&amp;O('*'),l=1,w.push(v={}),t&lt;d?v[k]=t|0:v[t]=1)),
K(p=w.pop()).map(i=&gt;(k+=(c=p[i])&gt;1?s+c+i:c&lt;-1?c+i:(c-1?'-':s)+(i||1),s=' + ')),k.replace(/-/g,' - ')||0)

Test in FireFox/FireBug console
;[&quot;(x+1)(x+2)&quot;,&quot;(a)(a-4)&quot;,&quot;(c+1)^3&quot;,&quot;(a+1)(f-2)&quot;,&quot;(x-2)(x+4)(x-5)(x+10)&quot;,&quot;(x+a+c)(b+g)&quot;,&quot;(r+4)^2(b)&quot;]
.map(x =&gt; console.log(x + &quot; -&gt; &quot; + X(x)))

Output
(x+1)(x+2) -&gt; x^2 + 3x + 2
(a)(a-4) -&gt; a^2 - 4a
(c+1)^3 -&gt; c^3 + 3c^2 + 3c + 1
(a+1)(f-2) -&gt; af + f - 2a - 2
(x-2)(x+4)(x-5)(x+10) -&gt; x^4 + 7x^3 - 48x^2 - 140x + 400
(x+a+c)(b+g) -&gt; xb + ab + cb + xg + ag + cg
(r+4)^2(b) -&gt; r^2b + 8rb + 16b