RepeatedNull

p... or RepeatedNull[p]

is a pattern object that represents a sequence of zero or more expressions, each matching p.

RepeatedNull[p,max]

represents from 0 to max expressions matching p.

RepeatedNull[p,{min,max}]

represents between min and max expressions matching p.

Details

  • p... can appear as an argument of any function. It represents any sequence of arguments.
  • All the objects in the sequence represented by p... must match p, but the objects need not be identical.
  • The expression p may, but need not, itself be a pattern object.

Examples

Basic Examples  (2)

Replace any list of zero or more a's by x:

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

Replace any list of zero or more f's with one argument:

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

See Also

Repeated  BlankNullSequence  PatternSequence  Longest  Shortest  StringExpression

Tutorials

Introduced in 1988
(1.0)