This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

ReplaceList

ReplaceList
attempts to transform the entire expression expr by applying a rule or list of rules in all possible ways, and returns a list of the results obtained.
ReplaceList
gives a list of at most n results.
  • When no transformation is possible, ReplaceList returns .
Give the results of all possible replacements:
Give only the first replacement that applies:
Give the results of all possible replacements:
In[1]:=
Click for copyable input
Out[1]=
Give only the first replacement that applies:
In[2]:=
Click for copyable input
Out[2]=
Use all rules that apply:
Use only the first rule:
Find the possible values to break a sum of terms in two:
Generate all subsets:
Find all elements that appear twice:
Find all sublists flanked by the same element:
New in 3