Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language >
Rules & Patterns
At the core of Mathematica's symbolic programming paradigm is the concept of transformation rules for arbitrary symbolic patterns. Mathematica's pattern language conveniently describes a very general set of classes of expressions, making possible uniquely readable, elegant and efficient programs.
lhsrhs (Rule) representation of replacement rule
expr/.rules (ReplaceAll) apply replacement rules to an expression
    
x_ any expression, named x
x__ sequence of expressions
a|b|c alternative forms
Repeated(..)  ▪ Except  ▪ Longest  ▪ Shortest  ▪ ...
    
Cases elements of a list or expression matching a given pattern
Position  ▪ MemberQ  ▪ MatchQ  ▪ Count  ▪ DeleteCases  ▪ ...
    
lhs=rhs, lhs:=rhs make assignments for arbitrary patterns
TUTORIALS
MORE ABOUT
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team