# Optional in MatchQ [duplicate]

Why isn't the first one True in:

MatchQ[{1}, Optional[{__Integer}, {2}]]
MatchQ[{1}, Optional[{_Integer}, {2}]]
MatchQ[{1}, {__Integer}]


False

True

True

or in:

MatchQ[{1}, p : {__Integer} : {2}]
MatchQ[{1}, p : {_Integer} : {2}]
MatchQ[{1}, p : {__Integer}]


False

True

True

p:v is a pattern object that represents an expression of the form p, which, if omitted, should be replaced by v.

So my guess was that

MatchQ[{1}, Optional[{__Integer}, {2}]]


should be equivalent to:

MatchQ[{1}, {__Integer}]


And even if you can explain that, why are middle examples True?

## marked as duplicate by Kuba♦May 30 '17 at 12:55

• The first one returns False. I am using version 11.1.1. But the others are True – happy fish May 30 '17 at 12:23
• @happyfish I meant it should be True, sorry for confusion :) – Kuba May 30 '17 at 12:37