p.. or Repeated[p]
is a pattern object that represents a sequence of one or more expressions, each matching p.
Repeated[p,max]
represents from 1 to max expressions matching p.
Repeated[p,{min,max}]
represents between min and max expressions matching p.
Repeated[p,{n}]
represents exactly n expressions matching p.
Repeated 
p.. or Repeated[p]
is a pattern object that represents a sequence of one or more expressions, each matching p.
Repeated[p,max]
represents from 1 to max expressions matching p.
Repeated[p,{min,max}]
represents between min and max expressions matching p.
Repeated[p,{n}]
represents exactly n expressions matching p.
Examples
open all close allBasic Examples (2)
Scope (7)
a.. represents a sequence of a's inside any head:
{f[], f[a, a], f[a, b], f[a, a, a]} /. f[a..] -> xReplace any list of a's with length up to 3:
{{}, {a}, {a, a}, {a, a, a}, {a, a, a, a}} /. {Repeated[a, 3]} -> xReplace any list of a's with lengths between 2 and 3:
{{}, {a}, {a, a}, {a, a, a}, {a, a, a, a}} /. {Repeated[a, {2, 3}]} -> xReplace lists of length exactly 3 elements:
{{}, {a}, {a, b}, {a, b, c}, {a, b, c, d}} /. {Repeated[_, {3}]} -> xReplace lists with lengths between 0 and 2 elements:
{{}, {a}, {a, a}, {a, a, a}, {a, b}, {b, b}} /. {Repeated[_, {0, 2}]} -> xReplace lists with 0 to 3 identical elements:
{{}, {a}, {a, a}, {a, a, a}, {a, b}, {b, b}} /. {Repeated[z_, {0, 3}]} -> xRequire only part of the pattern to be the same throughout the sequence:
MatchQ[{f[a, b], f[a, c], f[a, d]}, {f[x_, _]..}]MatchQ[{f[a, b], f[a, c], f[a, d]}, {f[_, x_]..}]Applications (1)
Properties & Relations (4)
Repeated[p] or p.. is equivalent to Repeated[p,{1,Infinity}]:
{{}, {a}, {a, a}, {a, a, a}} /. {a..} -> x{{}, {a}, {a, a}, {a, a, a}} /. {Repeated[a, {1, ∞}]} -> xRepeated[p,max] is equivalent to Repeated[p,{1,max}]:
{{}, {a}, {a, a}, {a, a, a}} /. {Repeated[a, 2]} -> x{{}, {a}, {a, a}, {a, a, a}} /. {Repeated[a, {1, 2}]} -> xRepeated[p] and Repeated[p,max] require at least one repeat:
{{}, {a}, {a, a}, {a, a, a}} /. {Repeated[a]} -> xRepeatedNull[p] and RepeatedNull[p,max] allow zero repeats:
{{}, {a}, {a, a}, {a, a, a}} /. {RepeatedNull[a]} -> xThe forms RepeatedNull[p,{min,max}] and Repeated[p,{min,max}] are equivalent:
{{}, {a}, {a, a}, {a, a, a}} /. {Repeated[a, {0, 2}]} -> x{{}, {a}, {a, a}, {a, a, a}} /. {RepeatedNull[a, {0, 2}]} -> xSo are the forms RepeatedNull[p,{n}] and Repeated[p,{n}]:
{{}, {a}, {a, a}, {a, a, a}} /. {Repeated[a, {2}]} -> x{{}, {a}, {a, a}, {a, a, a}} /. {RepeatedNull[a, {2}]} -> xPossible Issues (2)
Use parentheses or spaces to indicate that 1.. is not 1. followed by a dot:
{{1, 1}, {1}, {2, 1}} /. {(1)..} -> xA repeated named pattern will only match a sequence of identical repeats:
MatchQ[{4, 5, 6}, {Repeated[x_Integer]}]MatchQ[{4, 4, 4}, {Repeated[x_Integer]}]A repeated unnamed pattern can match a sequence of nonidentical elements:
MatchQ[{4, 5, 6}, {Repeated[_Integer]}]Tech Notes
Related Guides
Related Links
History
Introduced in 1988 (1.0) | Updated in 2007 (6.0)
Text
Wolfram Research (1988), Repeated, Wolfram Language function, https://reference.wolfram.com/language/ref/Repeated.html (updated 2007).
CMS
Wolfram Language. 1988. "Repeated." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/Repeated.html.
APA
Wolfram Language. (1988). Repeated. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Repeated.html
BibTeX
@misc{reference.wolfram_2026_repeated, author="Wolfram Research", title="{Repeated}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Repeated.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_repeated, organization={Wolfram Research}, title={Repeated}, year={2007}, url={https://reference.wolfram.com/language/ref/Repeated.html}, note=[Accessed: 13-June-2026]}