FilterRules[rules,patt]
filters the list rules by picking out only those rules whose left-hand sides match patt.
FilterRules[rules,{patt1,patt2,…}]
picks out rules whose left-hand sides match any of the patti.
FilterRules
FilterRules[rules,patt]
filters the list rules by picking out only those rules whose left-hand sides match patt.
FilterRules[rules,{patt1,patt2,…}]
picks out rules whose left-hand sides match any of the patti.
Details
- The rules in the list rules can be either -> or :> rules.
- If any of the patti is a rule of the form lhs->rhs, then it is treated the same as lhs.
- If patti is a string, it will also match a symbol whose name is the string.
- FilterRules[rules,Except[patt]] gives all rules except those whose left-hand sides match patt.
Examples
Basic Examples (2)
FilterRules[{a -> 1, b -> 2, c -> 3}, {b, a}]Filter for options that appear in Plot:
FilterRules[{PlotRange -> 3, MaxIterations -> 5}, Options[Plot]]Tech Notes
Related Guides
History
Text
Wolfram Research (2007), FilterRules, Wolfram Language function, https://reference.wolfram.com/language/ref/FilterRules.html.
CMS
Wolfram Language. 2007. "FilterRules." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FilterRules.html.
APA
Wolfram Language. (2007). FilterRules. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FilterRules.html
BibTeX
@misc{reference.wolfram_2026_filterrules, author="Wolfram Research", title="{FilterRules}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/FilterRules.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_filterrules, organization={Wolfram Research}, title={FilterRules}, year={2007}, url={https://reference.wolfram.com/language/ref/FilterRules.html}, note=[Accessed: 12-June-2026]}