This question already has an answer here:
I have a series of rules that I would like to apply to a series of expressions with variables, but cannot get Mathematica to correctly recognize that these rules should apply when my variables have exponents in them. For example, let's suppose I know that
a b /. a b -> 1 (* 1 *) a c b /. a b -> 1 (* c *)
So those work fine. Then I try:
a a b /. a b -> 1 (* a^2 b *)
In general, my rules are a good deal more complicated, but the problem is always the same. How do I get mathematica to recognize
a a so that it correctly applies the reduction rules?