Filter strings and removing text from string

Hello everyone,

I get 4 strings from serial in node connected to an arduino:

First I want to fiter the strings by type (T or HR) and by number (1 or 2). For example I just want the T1.

Any help would be greatly appreciated!

Node red

Did you write the Arduino code? If so, change it to transmit the name as topic and only put the value in payload.

Edit. Sorry, just read "serial"

So instead, format the data as JSON. Then pass the value through a JSON node and you can access the name and value easily.

If you can't do that, in a Function node you can do
const splits = msg.payload.trim().split(":")
The trim will strip the new line off the end and the split will split it into an array. Then splits[0] will contain "HR1" and splits[1] will contain "50.53"