This is a very simple question I hope you can help me with. I am experimenting with pattern matching. I want to write a pattern for a difference between two symbols, a-b, that recognises cases like {a-2,a-2b,f[x]-g[x]} as special cases while rejecting cases like {a,a+b,a+2b,f[x]+g[x]}.
So I started experimenting
Now when I write
MatchQ[a + 2b, a_ + b_]
It returns True
When I write
MatchQ[a - 2b, a_ - b_]
It returns False, which surprises me given the first code snippet returns True.
I imagined my question could be solved by:
mypattern = a_ - _Integer. b_.
But that doesn't seem to work. Any pointers greatly appreciated.


FullForms :) – rm -rf Jan 16 '14 at 06:13