To convert a Boolean test function such as `PrimeQ` or `IntegerQ` into a pattern one typically uses either [`Condition`][1] (`/;`) or [`PatternTest`][2] (`?`). There are specific strengths and purposes for each which are described in: https://mathematica.stackexchange.com/q/1835/121. Here is a simple and brief example of each: Cases[Range@10, _?PrimeQ] > {2, 3, 5, 7} Cases[Range@10, x_ /; PrimeQ[x]] > {2, 3, 5, 7} Be aware that the `PatternTest` operator `?` has [unusually high binding power][3] as seen in [this table][4] and with: Precedence[PatternTest] > 680. [1]: http://reference.wolfram.com/mathematica/ref/Condition.html [2]: http://reference.wolfram.com/mathematica/ref/PatternTest.html [3]: https://mathematica.stackexchange.com/q/1699/121 [4]: http://reference.wolfram.com/mathematica/tutorial/OperatorInputForms.html