# Commutativity of Times and pattern matching

I understand that Attributes of Times make a bit non intuitive the Pattern Matching of its arguments. However I do not understand why this gives False:

MatchQ[Times[a, b, c], Times[___, b, ___]]
False


Can you explain it to me?

• You need the pattern HoldPattern[Times[___, b, ___]] instead. If you look at the FullForm of Times[___, b, ___] you'll see that the attributes of Times mucked up the pattern. – Sjoerd Smit Feb 8 '19 at 10:24
• Related: (156282) – Michael E2 May 27 '19 at 14:46

Times[___,b,___] // FullForm


Times[b,Power[BlankNullSequence[],2]]

MatchQ[Times[a, b, c], HoldPattern[Times[___, b, ___]]]


True

or

MatchQ[Times[a, b, c], Unevaluated[Times[___, b, ___]]]


True