Select a particular rules out of a list
You can also use FilterRules:
rule = {beta -> 4, alpha -> 2, x -> 4, z -> 2, w -> 0.8};
FilterRules[rule, beta]
(* {beta -> 4} *)
FilterRules[rule, {beta, alpha}]
(* {beta -> 4, alpha -> 2} *)
Update: additional alternatives if you have V10:
KeyTake[rule,{alpha, x}]
(* or *) KeyTake[{alpha,x}][rule]
(* <|alpha->2,x->4|> *)
Normal@KeyTake[rule,{alpha, x}]
(* {alpha->2,x->4} *)
KeySelect[rule, MatchQ[#,alpha|x]&]
(* or *) KeySelect[MatchQ[#,alpha|x]&][rule]
(* <|alpha->2,x->4|> *)
Normal@KeySelect[rule, MatchQ[#,alpha|x]&]
(* {alpha->2,x->4} *)
Select[rule, MemberQ[{beta, alpha}, #[[1]]] &]
V9 style
If rule
is a simple list of rules:
Cases[rule, _[beta | alpha, _]]
{beta -> 4, alpha -> 2}
other ways to go:
{beta, alpha} /. (# -> Rule[##] & @@@ rule)