| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | /* |
| 4 | Package matcher implements vary formats of string matcher. |
| 5 | |
| 6 | Supported Format |
| 7 | |
| 8 | string |
| 9 | glob |
| 10 | regexp |
| 11 | simple patterns |
| 12 | |
| 13 | The string matcher reports whether the given value equals to the string ( use == ). |
| 14 | |
| 15 | The glob matcher reports whether the given value matches the wildcard pattern. |
| 16 | The pattern syntax is: |
| 17 | |
| 18 | pattern: |
| 19 | { term } |
| 20 | term: |
| 21 | '*' matches any sequence of characters |
| 22 | '?' matches any single character |
| 23 | '[' [ '^' ] { character-range } ']' |
| 24 | character class (must be non-empty) |
| 25 | c matches character c (c != '*', '?', '\\', '[') |
| 26 | '\\' c matches character c |
| 27 | |
| 28 | character-range: |
| 29 | c matches character c (c != '\\', '-', ']') |
| 30 | '\\' c matches character c |
| 31 | lo '-' hi matches character c for lo <= c <= hi |
| 32 | |
| 33 | The regexp matcher reports whether the given value matches the RegExp pattern ( use regexp.Match ). |
| 34 | The RegExp syntax is described at https://golang.org/pkg/regexp/syntax/. |
| 35 | |
| 36 | The simple patterns matcher reports whether the given value matches the simple patterns. |
| 37 | The simple patterns is a custom format used in netdata, |
| 38 | it's syntax is described at https://docs.netdata.cloud/libnetdata/simple_pattern/. |
| 39 | */ |
| 40 | package matcher |