({{, (RefLink[OrderlessPatternSequence, paclet:ref/OrderlessPatternSequence])[(Subscript[p, 1]),(Subscript[p, 2]),…] 
is a pattern object that represents a sequence of arguments matching (Subscript[p, 1]),(Subscript[p, 2]),… in any order.}})

OpenersNotesSection(Spacer1)Details

(RefLink[OrderlessPatternSequence, paclet:ref/OrderlessPatternSequence])[] represents a sequence of zero length.

(RefLink[OrderlessPatternSequence, paclet:ref/OrderlessPatternSequence]) can appear anywhere inside a pattern but cannot be the only element of a pattern.

OpenersPrimaryExamplesSection(Spacer1)Examples  (7)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Match elements of a list in any order:

MatchQ[{2,1},{OrderlessPatternSequence[1,2]}]

MatchQ[{1,2},{OrderlessPatternSequence[1,2]}]

Match function arguments in any order:

MatchQ[f[z,y,x],f[OrderlessPatternSequence[x,y,z]]]

The ordering of matched expressions is preserved:

Cases[{{3,2,1},{1,2,5},{3,1,2}},{OrderlessPatternSequence[1,2,3]}]

Replace[{1,"a",2,"b"},{a:OrderlessPatternSequence[__Integer,__String]}:>a]

OpenersExampleSection1(Spacer1)Scope  (2)

Use (RefLink[OrderlessPatternSequence, paclet:ref/OrderlessPatternSequence]) to make some of the function arguments orderless:

g[i_Integer,OrderlessPatternSequence[r_Real,s_String]]:={i,r,s}

g[1,26.2,"string"]

g[1,"string",26.2]

Only the last two arguments of g are orderless:

g[26.2,1,"string"]

Find the positions of lists that have two 1s and one 0:

t=Tuples[{0,1},3]

Position[t,{OrderlessPatternSequence[0,1,1]}]

OpenersExampleSection3(Spacer1)Properties & Relations  (1)

During expression pattern matching, (RefLink[PatternSequence, paclet:ref/PatternSequence]) matches expressions in fixed order:

MatchQ[{1,2,3,4},{PatternSequence[1,2,3,4]}]

MatchQ[{4,3,2,1},{PatternSequence[1,2,3,4]}]

(RefLink[OrderlessPatternSequence, paclet:ref/OrderlessPatternSequence]) matches expressions in arbitrary order:

MatchQ[{1,2,3,4},{OrderlessPatternSequence[1,2,3,4]}]

MatchQ[{4,3,2,1},{OrderlessPatternSequence[1,2,3,4]}]

OpenersExampleSection4(Spacer1)Possible Issues  (1)

(RefLink[OrderlessPatternSequence, paclet:ref/OrderlessPatternSequence]) matches against a sequence of patterns:

MatchQ[{4,3,2,1},OrderlessPatternSequence[{1,2,3,4}]]

MatchQ[{4,3,2,1},{OrderlessPatternSequence[1,2,3,4]}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[PatternSequence, paclet:ref/PatternSequence])  ▪  (RefLink[Orderless, paclet:ref/Orderless])  ▪  (RefLink[Repeated, paclet:ref/Repeated])  ▪  (RefLink[Alternatives, paclet:ref/Alternatives])  ▪  (RefLink[AnyOrder, paclet:ref/AnyOrder])  ▪  (RefLink[KeyValuePattern, paclet:ref/KeyValuePattern])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Patterns, paclet:guide/Patterns])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/41-more-about-patterns.html])(WebLink[: More about Patterns, https://www.wolfram.com/language/elementary-introduction/41-more-about-patterns.html])}})}})