1. Restructured configuration: Moved config_other and console to top level 2. Added common _match_pattern function for regex pattern matching 3. Implemented Unifi Hostname bug fix in is_hostname_unknown 4. Created common get_device_hostname function to eliminate code duplication 5. Added comprehensive test scripts for all new functionality 6. Added detailed documentation for all changes
28 lines
856 B
Markdown
28 lines
856 B
Markdown
# Explanation of "." in Regex Patterns
|
|
|
|
In the `exclude_patterns` section of the network_configuration.json file, you have patterns like:
|
|
```
|
|
"^.*sonos.*"
|
|
```
|
|
|
|
## What does the "." do in regex?
|
|
|
|
In regular expressions (regex):
|
|
|
|
- The "." (dot) matches any single character except a newline character
|
|
- It's different from "*" which is a quantifier meaning "zero or more of the preceding element"
|
|
|
|
## Breaking down the pattern "^.*sonos.*":
|
|
|
|
- `^` anchors to the beginning of the string
|
|
- `.*` means "zero or more of any character"
|
|
- `sonos` matches the literal string "sonos"
|
|
- `.*` again means "zero or more of any character"
|
|
|
|
This pattern matches any string that starts with any characters (or none), contains "sonos", and may have any characters after it.
|
|
|
|
Examples of matching strings:
|
|
- "sonos"
|
|
- "sonosdevice"
|
|
- "mysonosspeaker"
|
|
- "new-sonos-system" |