Glob Matcher: Difference between revisions
From Edge Threat Management Wiki - Arista
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 42: | Line 42: | ||
* "*" matches all values except null/unset | * "*" matches all values except null/unset | ||
* "" matches null and nothing else | * "" matches null and nothing else | ||
* All glob matching is case insensitive |
Revision as of 00:19, 9 November 2017
A Glob is a common way to match strings of characters against rules. An Untangle glob is similar to the syntax commonly used on Microsoft OSs to match filenames (example: "rm *.exe").
A glob matcher has two special characters: "*" means 0 or more of any characters (excluding return charater) and "?" means exactly 1 of any character (excluding return character).
Example | String | Description |
---|---|---|
String | XYZ | matches "XYZ" but NOT "xYZ" and NOT "XYZZ" |
String with * | X*Z | matches "XZ" and "XYZ" and "XYYZ" and "XyyyabcZ" but NOT "xYZ" and NOT "XYZA" |
String with * | X*Z* | matches "XZ" and "XYZ" and "XYYZ" and "XyyyabcZ" and "XYZA" but NOT "xYZ" |
String with ? | X?Z | matches "XYZ" and "XyZ" but NOT match "XZ" or "XYYZ" |
List of Globs | X,Z | matches "X" and "Z" but NOT match "Y" or "X,Z" |
Globs are often used in rules like URL rules and filename rules to match various strings. The left and rights side are implicitly anchored. If you wish to match if a string contains the match you will need to use "*foo*".
For those familiar with regular expression you can derive the glob equivalent by doing the following:
- replace "." with "\." to escape the special meaning of "." in regular expressions
- replace "?" with "." to match any character
- replace "*" with ".*" to match zero or more characters
Note:
- "*" matches all values except null/unset
- "" matches null and nothing else
- All glob matching is case insensitive