Using Regex with Smart Groups and Advanced Searches
This article explains how to configure search criteria based on a regular expression (regex) when using smart groups and advanced searches for mobile devices or computers in Jamf Pro.
Regex is a type of search pattern that uses special characters to help you find information. You can use regex to search for certain characters or patterns, words or phrases, or other complex information in Jamf Pro.
Mobile Devices: Jamf Pro 10.3.0 or later
Computers: Jamf Pro 10.7.0 or later
- Log in to Jamf Pro.
- Create a smart group or an advanced search for computers or mobile devices.
- Select or as the operator when creating your search criteria.
Common Regex Patterns
The following table lists some of the common regex patterns:
Regex Patterns |
Description |
---|---|
. | Matches any character, excluding new lines |
^ | Matches the beginning of a line |
? | Matches 0 or 1 occurrences of a value |
+ | Matches 1 or more times |
* | Matches 0 or more times |
$ | Matches the end of a line |
\d | Matches a numeric digit |
There are many additional regex patterns that can be used to search for information in Jamf Pro, and you are not limited to the ones listed here.
The > & < characters are XML reserved characters that overlap with valid regex characters. These reserved characters must be referenced as entities when the literal character is needed.
Regex Examples and Search Logic
Example 1
Objective | Example Values | Search Criteria | Values Returned |
---|---|---|---|
Find all buildings that end with a number | Building | Criteria: | Building 1 |
Example 2
Objective | Example Values | Search Criteria | Values Returned |
---|---|---|---|
Find all devices in all labs, excluding faculty machines | LAB-ART-101 | Criteria: | LAB-ART-101 |
Example 3
Objective | Example Values | Search Criteria | Values Returned |
---|---|---|---|
Find all devices that do not start with the word "Professor" | Professor Smith's iPad | Criteria: | iPad - Professor Jones |
Additional Information
For more information about advanced searches and smart groups, see the following sections in the Jamf Pro Documentation: