Extract

Extract[expr,list]
extracts the part of expr at the position specified by list.

Extract[expr,{list1,list2,}]
extracts a list of parts of expr.

Extract[expr,list,h]
extracts parts of expr, wrapping each of them with head h before evaluation.

Extract[list]
represents an operator form of Extract that can be applied to an expression.

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples  (6)Basic Examples  (6)

Extract the second part from an expression:

In[1]:=
Click for copyable input
Out[1]=

Extract a part nested in an expression:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Extract parts from multiple positions:

In[3]:=
Click for copyable input
Out[3]=

Extract the parts given by Position:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Use an extract operator:

In[1]:=
Click for copyable input
Out[1]=

Extract a part from an Association:

In[1]:=
Click for copyable input
Out[1]=

Extract using different specifications:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 1996
(3.0)
| Updated in 2014
(10.0)