Hi all,
I am sure I am doing something really simple here. I have a ping node which pings an IP address. On successful ping I get the msg.payload with the ms of the ping example:
{"payload":0.26,"topic":"192.168.x.x","_msgid":"1d672e78.b73ad2"}
What I am trying to do is use a regex to capture when it finds a number (which relates to the ms of the ping) change that to boolean - true.
I have another ping node that I set to an IP address I know is down, and the msg.payload is boolean false. I have a change node that reads the "false" and then changes it to a string of "down" - this works great - this is just testing to see that I can match the payload.
On the ping node that is pinging a active target, I am trying to take the ms in the payload and change it to "UP", now I have use the change node with regex the following regex which captures, numbers and decimales, i.e.
12345 OR 0.12345
Regex:
^([0-9]*[1-9][0-9]*(\.[0-9]+)?|[0]+\.[0-9]*[1-9][0-9]*)$
I test the regex on Regextester.com and it finds the right values.
However when I use the regex on the change node using the following config:
On the debug nothing is changed (like it is when doing the simple change on the ping to a host i know is down)
Any advise on what I am doing wrong her