Everything that Mathematica does can be thought of as derived from its ability to apply general transformation rules to arbitrary symbolic expressions. The Mathematica language provides flexible functions that give direct access to Mathematica's powerful rule transformation engine.
Replace — apply replacement rules to a complete expression
ReplaceList — a list of all possible ways to apply rules
SparseArray — give rules for values at particular positions in an array