Category filter
Simplify Your Workflow with Dynamic Group Regex Automation
Dynamic Group Regex (Regular Expressions) is the high-performance sorting engine for massive enterprise deployments. In environments exceeding 100,000 devices, standard “Contains” or “Starts with” filters are insufficient for complex naming schemas. Regex provides the surgical precision needed to automate device lifecycle management based on complex naming conventions, OS versions, or hardware serials.
By utilizing Regex, Hexnode acts as a Real-Time Traffic Controller: as soon as a device property changes, the logic re-evaluates the device and shifts it into the correct group, triggering immediate deployment of regional apps and security policies without human intervention.
Strategic Value for Large-Scale Fleets
- Naming Convention Enforcement: Segment devices like NYC-SALES-MBP-001 vs. LDN-HR-LAP-050 into regional/departmental buckets using a single logic string.
- Version Granularity: Distinguish between iOS 17.1.1 and iOS 17.2 instantly for targeted patch testing or “Pilot” groups.
- Hardware Lifecycle Intelligence: Isolate specific manufacturing batches or lease cycles by targeting patterns within Serial Numbers.
- Passcode Enforcement: Use Regex within macOS Passcode Policies to enforce high-entropy password patterns.
Common Regex Syntax for UEM
Use these standard symbols to build your automated filters:
| Symbol | Meaning | Example |
| ^ | Starts with | ^NYC matches anything starting with “NYC”. |
| $ | Ends with | LTP$ matches anything ending in “LTP”. |
| . | Any character | D.V matches DEV, DIV, or D1V. |
| * | Zero or more | NYC.* matches NYC-01, NYC-Laptop, etc. |
| [ ] | Character set | [A-Z] matches any single uppercase letter. |
| | | OR | (iPad|iPhone) matches either device type. |
2. Configuration Steps in Hexnode UEM
To build a Dynamic Group powered by Regex logic, you must utilize a two-step workflow: first extracting the data via a Custom Script, then grouping by the resulting Custom Attribute.
Step A: Extract Data using Regex in Custom Scripts
- Navigate to Manage > Select your target device(s) > Actions > Execute Custom Script.
- Upload your script (e.g., a script pulling device naming or system info).
- Check the box for Store output in custom attribute.
- Select your target Custom Attribute from the dropdown (e.g.,Regex_Department_Tag).
- In the Regex Pattern field, enter your Regex string to filter the terminal output.
- Scenario: You want to extract “SFO” from a hostname like SFO-Sales-iPad-01.
- Regex String: ^[A-Z]{3}
- Result: The string “SFO” is saved to the Custom Attribute.
Step B: Build the Dynamic Group
- Navigate to Manage > Device Groups > New Dynamic Group.
- Provide a Group Name (e.g., Automated – SFO Devices).
- Under Condition Filters, select Custom Attribute from the attribute dropdown.
- Select the specific attribute you populated in Step A.
- Set the Comparator to Equal to (or Contains).
- Enter the expected value (e.g., SFO).
- Click Preview to validate, then click Save Group.
3. Configuration: Advanced Password Policy Enforcement
For macOS, Hexnode allows admins to enforce bespoke password rules using Regex.
- Navigate to Policies > New Policy > macOS > Passcode.
- Locate the field for Regular Expression.
- Input the Regex string that dictates the exact character sequence requirements.
- Example Pattern: ^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{12,}$
- Result: Forces the user to create a passcode that is at least 12 characters long, containing at least one letter, one number, and one special character.
- Provide a clear Regex Description so the end-user knows exactly why their password attempt was rejected and what format is required.
Advanced Use Cases (The Matrix)
When writing custom scripts to feed Hexnode Custom Attributes, use these Regex patterns to filter your terminal outputs:
| Goal | Attribute | Regex Pattern |
| Legacy OS Targeting | OS Version | ^(12|13)\..* |
| Site-Specific iPads | Hostname | ^SFO-.*-iPad-.* |
| Premium Hardware | Model Name | .*(Pro|Ultra).* |
| Leased Batch ID | Serial Number | ^[A-Z]{3}5.* |
| MAC Address Filter | MAC Address | ^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$ |
Performance Optimization & Troubleshooting
To maintain sub-second evaluation speeds on massive databases, follow these “Performance First” rules:
- Anchoring: Always use ^ and $ to prevent unnecessary string scanning.
- Avoid Wildcard Overkill: Excessive use of * forces backtracking and slows the engine.
- Sync Frequency: Dynamic membership is re-evaluated during periodic syncs (typically every 15 mins).
Troubleshooting
- Device not appearing? Check for hidden leading/trailing spaces in the Value field.
- Case Sensitivity: Regex in Hexnode is case-sensitive by default. Use (?i) at the start of your pattern (e.g., (?i)^nyc-.*) to force case-insensitivity.
- Special Characters: To match a literal period (e.g., version 17.2), escape it with a backslash: 17\.2.