0

I am trying to split the following llap message with node red:

a--A02+1023-

so I end up with the integers after the '+' sign. Sometimes there are three numbers with a '-' for the final character. eg. a--A02+982--

once i have this 3 or four digit number I can extrapolate relevant sensor values

Ive managed it with python but the ways of node red are new to me.

Many thanks

hardillb
  • 54,545
  • 11
  • 67
  • 105
idi0tech
  • 11
  • 1
  • 1

1 Answers1

2

Pass the message through a function node and use a regular expression

var regExp = /.*\+(\d+)-/;
var results = regExp.exec(msg.payload);
msg.payload = results[1];

return msg;
hardillb
  • 54,545
  • 11
  • 67
  • 105