$split doesn't support default settings?

Hi There,

This might be a known unknown since I'm using NR 4.0.9 - so it might be fixed already.

Or maybe it's not a bug? In which case what am I doing wrong!

It concerns JSONata $split:

The description gives me to understand that $split("fubar") is a valid expression and should give me the same as $split("fubar", ""), i.e. ["f","u",...]

[{"id":"4fa3f5ebb2b075ee","type":"inject","z":"427d65940cf71aac","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"$split(\"fubar\")","payloadType":"jsonata","x":3289,"y":624,"wires":[["034f65b11c1f431e"]]},{"id":"034f65b11c1f431e","type":"debug","z":"427d65940cf71aac","name":"debug 27","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":3366,"y":512,"wires":[]}]

but it doesn't instead, I see this in the debug panel:

Screenshot 2026-05-13 at 10.08.25

Adding the separator value, i.e. $split("fubar", ""), works:

I know this is niche since JSONata is niche but hey!

Cheers!

Doesn't work in 5.0.0-beta.6 either, so probably either a bug or mis-information in the description.
In the JSONata description it says

The separator parameter can either be a string or a regular expression (regex). If it is a string, it specifies the characters within str about which it should be split. If it is the empty string, str will be split into an array of single characters. If it is a regex, it splits the string around any sequence of characters that match the regex.

which implies that the separator must exist - even if an empty string. So the chances are that the description of the function is in error

I would also split the difference and update the documentation - obviously it isn't something that is used often and if so, then correctly. The error message isn't something that is overseen if it occurs.

Well done & thank you :grin:

Happy cake day btw :wink: