simplified mqtt topic regex
This commit is contained in:
parent
6eb9898778
commit
356e502ed8
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
package weathersource
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -12,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
var uuidRegexPattern = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
|
||||
var mqttTopicRegexPattern = "^sensor/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/(temp|pressure|humidity|co2level)$"
|
||||
var mqttTopicRegexPattern = fmt.Sprintf("^sensor/%s/(temp|pressure|humidity|co2level)$", uuidRegexPattern)
|
||||
|
||||
var regexTopic *regexp.Regexp = regexp.MustCompile(mqttTopicRegexPattern)
|
||||
var regexUuid *regexp.Regexp = regexp.MustCompile(uuidRegexPattern)
|
||||
|
|
Loading…
Add table
Reference in a new issue