Skip to content

Pattern Matching

15 built-in function(s) in this category.

  • Blank — _ or Blank[] represents any single expression. (Stable)
  • BlankNullSequence — ___ or BlankNullSequence[] represents a sequence of zero or more expressions. (Stable)
  • BlankSequence — __ or BlankSequence[] represents a sequence of one or more expressions. (Experimental)
  • Cases — Cases[{e1, e2, ...}, pattern] gives a list of the ei that match the pattern. (Stable)
  • Count — Count[list, pattern] gives the number of elements in list that match pattern. (Stable)
  • Default — Default[f] (Experimental)
  • DeleteCases — DeleteCases[expr, pattern] removes all elements of expr that match pattern. (Stable)
  • HoldPattern — HoldPattern[expr] (Stable)
  • Longest — Longest[p] is a pattern object that matches the longest sequence consistent with the pattern p. (Stable)
  • MatchQ — MatchQ[expr, form] (Stable)
  • Optional — patt:def or Optional[patt, def] (Stable)
  • Position — Position[expr, pattern] gives a list of the positions at which objects matching pattern appear in expr. (Stable)
  • Repeated — p.. or Repeated[p] is a pattern object that represents a sequence of one or more expressions, each matching p. (Stable)
  • RepeatedNull — p... or RepeatedNull[p] is a pattern object that represents a sequence of zero or more expressions, each matching p. (Stable)
  • Shortest — Shortest[p] is a pattern object that matches the shortest sequence consistent with the pattern p. (Stable)