How to regexextract for complex and varies length word in the middle

Hi
I need help to clean this 'customer name ' colomn that combine with many information such as
[C18-0000193]POLYTAMA PROPINDO,[C20-00002783]Riyan Sukmana
[C21-00004818]Kilang Pertamina Internasional,PT (cont-proc services) ,[C21-00004819]Rony Budiman
which is the length in left and right word is very varies.

What I need only POLYTAMA PROPINDO and Kilang Pertamina Internasional,PT (cont-proc services)

Since Metabase doesn't support SPLIT syntax, my hope only regexextract, unfortunately, the documentation is only a few.

Please help for the custom colomn using regexextract
Thank you
Regards
Taufik

Hi @taufik
It's just regular expression, so you can use something like https://regex101.com/ to help.
Something like this could work:

trim(regexextract([Customer Name], "\[[^\]]+\]\s*(.+)\s*,\["))

Hi @flamber
Thank you for your quick response
I have try your code and its work!! I'm very happy :laughing:

But sorry to ask again unfortunately in the colomn were some records like this
[C22-00006009][C20-00001281]TEGUHARTA LESTARI, PT,[C20-00001311]SUHARDI NICOLAUS
which is your regexextract code can not remove the second [C20-00001281]
Please help to solve this problem.

Thank you very much
Best Regards
Taufik

@taufik Your question has nothing to do with Metabase, but is about general regular expressions
https://regex101.com/r/S7sXNx/1

trim(regexextract([Customer Name], "\[[^\]]+\]\s*([^\[\]]+)\s*,\["))

Hi @flamber
Thank you very much for your help. You are the best.
I learn much from your code :smiley:

Thank you
Best Regards