REGEX Question using JSONata (Change node)

Hi.
I'm trying to extract "Total: $10.00" from this text

02-01 00:00 02-28 23:59$10.00 $0.00 $10.00Subtotal: $10.00Tax: $0.00Total: $10.00Thanks for your purchase!Please do not hesitate to contact us if you have any questions.(View as PDF...

I'm successfully doing it with this:

Total:\s\$\d+.\d+

But when I inject it in a change node, nothing comes out.
This is proably related to the fact that I'm not using in the correct way the $match commant in JSONata

$match(payload,(Total:\s\$\d+.\d+))

My flow in attach, any help appreciated!

[{"id":"ba8c73b6.b5d17","type":"inject","z":"2df38b47.f4ff84","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"02-01 00:00 02-28 23:59$10.00 $0.00 $10.00Subtotal: $10.00Tax: $0.00Total: $10.00Thanks for your purchase!Please do not hesitate to contact us if you have any questions.(View as PDF...","payloadType":"str","x":1160,"y":840,"wires":[["529c5bfb.1b23a4","c7362f00.e73c4"]]},{"id":"76a729e7.abf3e8","type":"debug","z":"2df38b47.f4ff84","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1590,"y":840,"wires":[]},{"id":"17006627.8045ba","type":"debug","z":"2df38b47.f4ff84","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1610,"y":880,"wires":[]},{"id":"529c5bfb.1b23a4","type":"change","z":"2df38b47.f4ff84","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$match(payload,(Total:\\s\\$\\d+.\\d+))","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1400,"y":840,"wires":[["76a729e7.abf3e8"]]},{"id":"c7362f00.e73c4","type":"switch","z":"2df38b47.f4ff84","name":"","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"(Total:\\s\\$\\d+.\\d+)","vt":"env","case":false}],"checkall":"true","repair":false,"outputs":1,"x":1370,"y":880,"wires":[["17006627.8045ba"]]}]

Try

$match(payload,/Total:\s\$\d+.\d+/) // should return Total: $10.00
$match(payload,/(?<=Total:\s)\$\d+.\d+/) // should return $10.00

thanks so much!

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