Wolfram: MatchQ
MatchQ
MatchQ
-
check if a Pattern match a expression.
💡 TIP: The pattern must match the whole expression.
MatchQ[ 4 , _Integer] (* True *) MatchQ[ {3,4} , _Integer] (* False *) (* HHHH------------------------------ *) MatchQ[ {3,4} , {_,_}] (* True *) MatchQ[ x + y , Plus[_, __]] (* True *)
(* literal expression example *) MatchQ[ 4 , 4] (* True *) MatchQ[ t , t] (* True *) MatchQ[ {3,x} , {3,x}] (* True *)