I'm really -1 to the use of match unless I know it's not going to slow series down too much. Could you check the run time with what you have and with the following? And should you be testing q and r to see if they are real?

```
def omatch(t):
    # (s1*(s2*x)**r)**q -> x**(r*q)
    from sympy.core.function import _coeff_isneg
    r = q = S.One
    if t in (x, -x):
        pass
    elif not t.is_Pow:
        return
    else:
        b, q = t.args
        if b in (x, -x):
            pass
        elif b.is_Pow:
            b, r = b.args
            if b != x:
                return
        elif b.is_Mul and _coeff_isneg(b):
            b = -b
            if not b.is_Pow:
                return
            b, r = b.args
            if b not in (x, -x):
                return
    return r*q  # test if r and q are real?

>>> omatch(x**q)
q
>>> omatch((-x)**q)
q
>>> omatch((x**r)**q)
q*r
>>> omatch((-x**r)**q)
q*r
>>> omatch((-(-x)**r)**q)
q*r
>>> omatch(x)
1
>>> omatch(-x)
1
>>> omatch(1/x)
-1
>>> omatch(x**2)
2
>>> omatch(x**I)
I
>>> omatch(y/x)
>>> omatch(y+x)
```