Hi ..
you could use the javascript split()
method on the string. it is a string right ?
first split on "-Total Balance: "
and then on the next space and bracket " ("
msg.payload = msg.payload.split("-Total Balance: ")[1].split(" (")[0]
Test Flow:
[{"id":"4167eff6f372de2a","type":"inject","z":"54efb553244c241f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":560,"wires":[["1afa79ba49f417ca"]]},{"id":"20a4b7f8e898d211","type":"function","z":"54efb553244c241f","name":"","func":"\nmsg.payload = msg.payload.split(\"-Total Balance: \")[1].split(\" (\")[0]\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":510,"y":560,"wires":[["1f8cf867e41c3b5f"]]},{"id":"1f8cf867e41c3b5f","type":"debug","z":"54efb553244c241f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":560,"wires":[]},{"id":"1afa79ba49f417ca","type":"template","z":"54efb553244c241f","name":"text","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Wallet height: 760264\nSync status: Synced\nBalances, fingerprint: 3007886911\nWallet ID 1 type STANDARD_WALLET\n -Total Balance: 2958.5843702 xcc (295858437020 mojo)\n -Pending Total Balance: 2958.5843702 xcc (295858437020 mojo)\n -Spendable: 2958.5843702 xcc (295858437020 mojo)","output":"str","x":330,"y":560,"wires":[["20a4b7f8e898d211"]]}]