regex - Substring in DataWeave up to the occurrence of a character -


in dataweave, how substring input value such output occurrence of character? input value abcd_123 , need take underscore, output abcd. regex achieves /[^_]*/, can't find way implement using dataweave. appreciated!

based on @wiktorstribiżew's comment, way solved declaring function:

%function split(text) text splitby "_"

and in dw mapping, take value as:

output: split(payload.input)[0]


Comments