Hi,
I am trying to check if there is an easy way to use regex to verify if a received topic matches a wildcard subscription.
example:
subscribed: "+/room/+/light/+"
received "house1/room/bedside/light/status"
I don't have experience with Regex so I was wondering if someone can help with an example function that gets received string and subscribed string and return true if (like in this case the received matched the wildcard definition.
thanks a lot!
Sub CreateMatch(text As String) As String
If text.Contains("+") Then
Dim a As String = text.Replace("+","([\w\.\-\$]+)")
a= a.Replace("\/","\\/")
End If
If a.Contains("#") Then
Dim a As String = a.Replace("#","([\w\.\-\$]+(\/[\w\.\-\$]+)*)")
End If
Return a
End Sub