Skip to content

DeleteCases

DeleteCases[expr, pat] returns a new expression of all elements in expr that do not match pat.

Attributes[DeleteCases] := {Protected}

Simple examples

In[1]:= DeleteCases[{5, 2, 3.5, x, y, 4}, _Integer]
Out[1]= {3.5, x, y}
In[2]:= DeleteCases[{5, 2, 3.5, x, y, 4}, _Real]
Out[2]= {5, 2, x, y, 4}
In[3]:= DeleteCases[3.5 + x + y, _Real]
Out[3]= x + y