AllMatch

AllMatch[{e1,e2,},form]

yields True if ei matches the pattern form for all of the ei.

AllMatch[expr,form,level]

tests parts of expr at level level.

AllMatch[form]

represents an operator form of AllMatch that can be applied to an expression.

Details

Examples

open allclose all

Basic Examples  (4)

Check if all elements of a list match a pattern:

Check if all elements of a matrix match a pattern:

Use the operator form of AllMatch:

Check if all values of an association match a pattern:

Scope  (4)

AllMatch may be applied to expressions with any head:

AllMatch can operate on ragged expressions:

By default, AllMatch operates at level 1:

Use Verbatim to test for a literal blank:

Properties & Relations  (6)

AllMatch[list,form] is equivalent to NoneMatch[list,Except[form]]:

AllMatch[list,form] works efficiently on sparse vectors:

AllMatch[list,form] checks the parts of list in order, stopping as soon as form does not match:

AllMatch[list,form] is equivalent to AllTrue[list,MatchQ[form]]:

AllMatch[{e1,e2,},form] is equivalent to And[MatchQ[e1,form],MatchQ[e2,form],]:

AllMatch[list,e1|e2|] is equivalent to ContainsOnly[list,{e1,e2,}]:

Possible Issues  (1)

For associations, AllMatch tests only values:

Wolfram Research (2024), AllMatch, Wolfram Language function, https://reference.wolfram.com/language/ref/AllMatch.html.

Text

Wolfram Research (2024), AllMatch, Wolfram Language function, https://reference.wolfram.com/language/ref/AllMatch.html.

CMS

Wolfram Language. 2024. "AllMatch." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AllMatch.html.

APA

Wolfram Language. (2024). AllMatch. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AllMatch.html

BibTeX

@misc{reference.wolfram_2024_allmatch, author="Wolfram Research", title="{AllMatch}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/AllMatch.html}", note=[Accessed: 15-October-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_allmatch, organization={Wolfram Research}, title={AllMatch}, year={2024}, url={https://reference.wolfram.com/language/ref/AllMatch.html}, note=[Accessed: 15-October-2024 ]}