Pattern Matching Functions

Pattern matching makes possible some of the most succinct and elegant programs in the Wolfram Language—immediately compressing large numbers of conditional cases into simple, readable and efficient pattern specifications.

(RefLink[Cases, paclet:ref/Cases]) — a list of elements matching a pattern

(RefLink[Position, paclet:ref/Position]) — positions of elements matching a pattern

(RefLink[Count, paclet:ref/Count]) — a count of occurrences of a pattern

(RefLink[ReplaceAll, paclet:ref/ReplaceAll]) ((RefLink[/., paclet:ref/ReplaceAll])) — replace all occurrences of a pattern

(RefLink[DeleteCases, paclet:ref/DeleteCases]) — delete all occurrences of a pattern

(RefLink[Set, paclet:ref/Set]) ((RefLink[=, paclet:ref/Set])), (RefLink[SetDelayed, paclet:ref/SetDelayed]) ((RefLink[:=, paclet:ref/SetDelayed])) — define transformations for patterns

(RefLink[MemberQ, paclet:ref/MemberQ]) — test if any member of a list matches a pattern

(RefLink[FreeQ, paclet:ref/FreeQ]) — test if an expression is free of a pattern

(RefLink[MatchQ, paclet:ref/MatchQ]) — test whether an expression matches a pattern

Patterns for Part Specifications