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.
Cases — a list of elements matching a pattern
Position — positions of elements matching a pattern
Count — a count of occurrences of a pattern
ReplaceAll (/.) — replace all occurrences of a pattern
ReplaceRepeated ▪ Replace ▪ ReplaceList ▪ ReplaceAt
DeleteCases — delete all occurrences of a pattern
Set (=), SetDelayed (:=) — define transformations for patterns
MatchQ — test whether an expression matches a pattern
FreeQ — test if an expression is free of a pattern
MemberQ — test if any member of a list matches a pattern
AllMatch, AnyMatch, NoneMatch — test elements of a list against a pattern
KeyMemberQ, KeyFreeQ — test the keys rather than values of an association
StringMatchQ — test whether a string or biomolecular sequence matches a string pattern
StringFreeQ ▪ StringContainsQ ▪ ...