Hi,
You could either do it in a java action or do it manually in a microflow by using a combination of find and substring see - https://docs.mendix.com/refguide/string-function-calls
-Andrej
You should probably use a proper HL7v2 library (which I am guessing is the EDIFACT dialect you are trying to parse here) and not try to build your own.
https://hapifhir.github.io/hapi-hl7v2/ comes to mind but I am sure there are others as well.