OH3 Widget splitting by capital Letter

Hi,

I have a widget where i get the name of an item by splitting it by underscore an and showing the first part of the split =loop.item.name.split('_')[0]

No i want to split the result of the above code by capital letters but i don’t know how…
Input string: FensterKinderzimmerNord
Wanted result: Fenster Kinderzimmer Nord

I already tried the following: .replace('([A-Z])', ' $1') but it is no working…
Does anybody has an idea how to do this?

All the JavaScript REGEX I see use / /.

/[A-Z]/

Supporting regexes is a wont-fix in jsep, the library parsing expressions, unfortunately:

Thanks for clarification, then i will try to find a other solution.