AnyMatch

AnyMatch[{e1,e2,},form]

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

AnyMatch[expr,form,level]

tests parts of expr at level level.

AnyMatch[form]

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

Details

Examples

open allclose all

Basic Examples  (4)

Check if any element of a list matches a pattern:

Check if any element of a matrix matches a pattern:

Use the operator form of AnyMatch:

Check if any value of an association matches a pattern:

Scope  (4)

AnyMatch may be applied to expressions with any head:

AnyMatch can operate on ragged expressions:

By default, AnyMatch operates at level 1:

Use Verbatim to test for a literal blank:

Properties & Relations  (6)

AnyMatch[list,form] is equivalent to !NoneMatch[list,form]:

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

0.000037`

AnyMatch[list,form] checks the parts of list in order, stopping as soon as form matches:

AnyMatch[list,form] is equivalent to AnyTrue[list,MatchQ[form]]:

AnyMatch[{e1,e2,},form] is equivalent to Or[MatchQ[e1,form],MatchQ[e2,form],]:

AnyMatch[list,e1|e2|] is equivalent to ContainsAny[list,{e1,e2,}]:

Possible Issues  (1)

For associations, AnyMatch tests only values:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2024_anymatch, author="Wolfram Research", title="{AnyMatch}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/AnyMatch.html}", note=[Accessed: 21-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_anymatch, organization={Wolfram Research}, title={AnyMatch}, year={2024}, url={https://reference.wolfram.com/language/ref/AnyMatch.html}, note=[Accessed: 21-December-2024 ]}