Slice data from string

I want to slice data from a string.

b'\x00\n'
b'/ISk5\\2MT382-1003\r\n'
b'\r\n'
b'0-0:96.1.1(5A42424430303530313739353132)\r\n'

It is from reading P1 meter.
The name ISk5 and type 2MT382 and the serial number can vary in length.
How easley to separate name,type and serial number ?

msg.payload = msg.payload.split(/\\r\\n|\\\\|-|\//).slice(1,4)
return msg;

Example flow

[{"id":"5dc16829e125c4af","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":80,"y":3980,"wires":[["415cf5afd2ae41ca"]]},{"id":"415cf5afd2ae41ca","type":"template","z":"452103ea51141731","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"b'\\x00\\n'\nb'/ISk5\\\\2MT382-1003\\r\\n'\nb'\\r\\n'\nb'0-0:96.1.1(5A42424430303530313739353132)\\r\\n'","output":"str","x":220,"y":3980,"wires":[["12d11047d427defd"]]},{"id":"12d11047d427defd","type":"function","z":"452103ea51141731","name":"function 18","func":"msg.payload = msg.payload.split(/\\\\r\\\\n|\\\\\\\\|-|\\//).slice(1,4)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":3980,"wires":[["08b4a0563ae6be59"]]},{"id":"08b4a0563ae6be59","type":"debug","z":"452103ea51141731","name":"debug 111","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":3980,"wires":[]}]

output

[
  "ISk5",
  "2MT382",
  "1003"
]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.