I am trying to split a hexadecimal string, 3E8.8F5C28F5C28
, into individual bytes. I tried the following code to split the string:
const string = "3E8.8F5C28F5C28";
const res = string.split(/([dw]{2})/).filter(e => e);
But it gave me this result:
[
'3E', '8.', '8F',
'5C', '28', 'F5',
'C2', '8'
]
I need to split the given hex string like 03 E8 8F
. I don’t want the fractional values after 8F.
How to achieve this?