sym:obj or Pattern[sym,obj]

represents the pattern object obj, assigned the name sym.


  • The name sym must be a symbol.
  • The object obj can be any pattern object.
  • When a transformation rule is used, any occurrence of s on the righthand side is replaced by whatever expression it matched on the lefthand side.
  • The operator : has a comparatively low precedence. The expression x:_+_ is thus interpreted as x:(_+_), not (x:_)+_.
  • The form s_ is equivalent to s:_. Similarly, s_h is equivalent to s:_h, s__ to s:__, and so on. »


open allclose all

Basic Examples  (1)

Give a name to lists of integers:

Scope  (1)

Use Pattern in any pattern-matching function including ReplaceAll:


And MatchQ:

Properties & Relations  (1)

The forms s_ and s:_ are equivalent:

This extends to forms with a specified head:

As well as forms involving BlankSequence and BlankNullSequence:

Possible Issues  (1)

The input s:v is a form of Pattern only if s is a symbol:

If s is a special input form for Blank[] or Pattern[sym,Blank[]], then s:v is Optional[s,v]:

Forms involving BlankSequence[] and BlankNullSequence[] are similar:

If s is any other expression, the form is not valid input:

Wolfram Research (1988), Pattern, Wolfram Language function,


Wolfram Research (1988), Pattern, Wolfram Language function,


Wolfram Language. 1988. "Pattern." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (1988). Pattern. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_pattern, author="Wolfram Research", title="{Pattern}", year="1988", howpublished="\url{}", note=[Accessed: 30-May-2024 ]}


@online{reference.wolfram_2024_pattern, organization={Wolfram Research}, title={Pattern}, year={1988}, url={}, note=[Accessed: 30-May-2024 ]}