I am using the REGEX addon and trying to take some mqtt input and clean it up however, I am able to get what I want on the test site Regexr test site but when I put it in my item file it gives now out output. I understand that the REGEX addon adds ^$ to beginning and end of the REGEX (not sure why) but I have accounted for this in my REGEX test. Here’s the string:
:{"actual": 12.92, "target": 0.0}
and here’s the regex that I used
^.*(actual)(": )(\d\d.\d\d)(, ")(target)(": )(\d.\d)\}$
I substituted for $1 $3 $5 $7 and get the output of
actual 12.92 target 0.0
This REGEX is not exactly what I want but if I can make it work with just this then I can build from there.
When I put that in my item:
String Carlos "Carlos [:%s]" {mqtt="<[mosquitto:carlos/temperature/bed:state:REGEX (s/.*(actual)(": )(\d\d.\d\d)(, ")(target)(": )(\d.\d)\}/$1 $3 $5 $7/g)"}
I get no output and in the log it just says it cannot retrieve item.
I have tried many iterations the best I could was get a random part of the text to show up. I am sure I am missing something with the way the REGEX works inside openhab 2.4 I might be missing some escapes or other things. I have looked at the documentation but it seems to explain that if it works in one of the testers it should work inside openhab, clearly that is not the case. - Any guidance is greatly appreciated.