From 5f364b4cd4b81c01459f36b5904837184a30e12a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Arg=C3=A9rus?= Date: Tue, 15 Aug 2023 20:19:05 +0200 Subject: [PATCH] Add wildcard matching doc --- doc/wildcard_matching.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 doc/wildcard_matching.md diff --git a/doc/wildcard_matching.md b/doc/wildcard_matching.md new file mode 100644 index 000000000..cc5452495 --- /dev/null +++ b/doc/wildcard_matching.md @@ -0,0 +1,26 @@ +### Matching rules + +* An empty "" pattern will match any signal. +* A pattern without any asterisk either matches a signal directly or any signal that is a direct or indirect child of the branch matching the pattern. +* An asterisk "`*`" at the end of a pattern will match any signal that is a direct child of the branch indentified by the preceding pattern. +* A double asterisk "`**`" at the end of a pattern matches any signal that is a direct or indirect child of the branch identified by the preceding pattern. +* An asterisk "`*`" in the middle (or beginning) of a pattern matches any signal that has a branch (of any name) at that position. +* A double asterisk "`**`" in the middle (or beginning) of a pattern matches any signal that has zero or more branches at that position. + +### Examples + +| Path | Matches | +|---------------------|--------------------------------------| +| `""` | Everything | +| `"Vehicle"` | Everything starting with `Vehicle` | +| `"Vehicle.Cabin.Sunroof"` | `Vehicle.Cabin.Sunroof.Position`
`Vehicle.Cabin.Sunroof.Shade.Position`
`Vehicle.Cabin.Sunroof.Shade.Switch`
`Vehicle.Cabin.Sunroof.Switch` | +| `"Vehicle.Cabin.Sunroof.**"` | `Vehicle.Cabin.Sunroof.Position`
`Vehicle.Cabin.Sunroof.Shade.Position`
`Vehicle.Cabin.Sunroof.Shade.Switch`
`Vehicle.Cabin.Sunroof.Switch` | +| `"Vehicle.Cabin.Sunroof.*"` | `Vehicle.Cabin.Sunroof.Position`
`Vehicle.Cabin.Sunroof.Switch` | +| `"Vehicle.Cabin.Sunroof.*.Position"` | `Vehicle.Cabin.Sunroof.Shade.Position` | +| `"**.Sunroof.*.Position"` | `Vehicle.Cabin.Sunroof.Shade.Position` | +| `"*.*.*.*.Position"` | `Vehicle.Cabin.Sunroof.Shade.Position` | +| `"Vehicle.Cabin.Sunroof.**.Position"` | `Vehicle.Cabin.Sunroof.Position`
`Vehicle.Cabin.Sunroof.Shade.Position` | +| `"**.Sunroof"` | Nothin | +| `"**.Sunroof.**"` | `Vehicle.Cabin.Sunroof.Position`
`Vehicle.Cabin.Sunroof.Shade.Position`
`Vehicle.Cabin.Sunroof.Shade.Switch`
`Vehicle.Cabin.Sunroof.Switch` | +| `"*.Sunroof"` | Nothing| +| `"Sunroof"` | Nothing|