Rule Engine DSL Reference
RuleDock's Domain-Specific Language (DSL) allows you to create powerful sorting rules using readable expressions. This reference covers all available operators and patterns.
Overview
A DSL expression evaluates properties of a desktop icon and returns true or false. If true, the icon is sorted into the target fence.
ext == '.png'
This matches any file with a .png extension.
Available Properties
You can reference these properties of each desktop icon:
| Property | Description | Example Value |
|---|---|---|
ext |
File extension (including dot) | .png, .docx, .exe |
name |
File name (without path) | Screenshot_2026.png |
path |
Full file path | C:\Users\John\Desktop\file.txt |
Comparison Operators
Equality (==)
Checks if a property exactly equals a value. Case-insensitive.
ext == '.PDF' # Matches .pdf, .PDF, .Pdf, etc.
name == 'readme.txt'
Inequality (!=)
Checks if a property does NOT equal a value.
ext != '.tmp' # Exclude temporary files
path != 'C:\Windows'
Contains (contains)
Checks if a property contains a substring. Case-insensitive.
name contains 'backup' # Matches "backup.zip", "my_backup_2026.rar"
path contains 'Projects'
In List (in [...])
Checks if a property matches any value in a list.
ext in ['.jpg', '.png', '.gif', '.webp'] # Image files
ext in ['.doc', '.docx', '.pdf'] # Documents
Logical Operators
AND (and)
Both conditions must be true.
ext == '.png' and path contains 'Screenshots'
# Match: C:\Users\Screenshots\image.png
# No match: C:\Users\Documents\image.png
OR (or)
Either condition must be true.
ext == '.exe' or ext == '.msi'
# Match: setup.exe, install.msi
Combining AND and OR
AND has higher precedence than OR. Use complex expressions carefully:
# This means: (A AND B) OR C
ext == '.png' and name contains 'screenshot' or ext == '.gif'
String Quoting
Values can be quoted with single or double quotes:
name contains "my file" # Double quotes
name contains 'my file' # Single quotes
ext == .txt # No quotes (simple values)
Use quotes when values contain spaces or special characters.
Regex Rule Type
For pattern matching beyond DSL, use the Regex rule type (not an expression operator). This applies a regex pattern to the file name.
# Match "Screenshot_20260205_123456.png"
^Screenshot_\d{8}_\d{6}\.png$
# Match version patterns like "app_v2.1.exe"
_v\d+\.\d+\.exe$
# Match files starting with "backup" or "archive"
^(backup|archive)
# Match any numbered file
\(\d+\)\.[a-z]+$ # e.g., "file (1).txt"
Regex Safety
All regex patterns are evaluated with:
- Case-insensitive matching by default
- 200ms timeout to prevent catastrophic backtracking (ReDoS)
- Patterns that timeout are skipped silently
Complete Examples
Sort Design Files
ext in ['.psd', '.ai', '.xd', '.fig', '.sketch']
Sort Development Files
ext in ['.js', '.ts', '.py', '.cs', '.java', '.cpp', '.h']
Sort Project Screenshots
ext in ['.png', '.jpg'] and path contains 'Projects'
Sort Work Documents (Exclude Personal)
ext in ['.docx', '.xlsx', '.pptx'] and path contains 'Work' and name != 'personal'
Installers and Setup Files
ext in ['.exe', '.msi'] and name contains 'setup'
or
ext in ['.exe', '.msi'] and name contains 'install'
Troubleshooting
Expression Not Matching
- Check for typos in property names (
ext,name,path) - Remember comparisons are case-insensitive
- Use the Preview feature in rule settings to test
- Verify the file actually has the extension you expect
Regex Not Working
- Test your regex on regex101.com first
- Escape special characters:
\.for literal dot,\\for backslash - Complex patterns may timeout—simplify if needed