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 > Patterns >

Alternatives (|)

p1|p2|...
is a pattern object which represents any of the patterns pi.
  • If a named pattern such as x_ appears in pi that are not used in a particular match, then the named pattern is taken to have a value that is a zero-length sequence Sequence[].
Replace instances of either a or b:
Replace instances of either a or b:
In[1]:=
Click for copyable input
Out[1]=
Pick out integers or reals:
New in 2
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team