Split text using Regex

Hi guys,. I have some text in excel column.
I want to split the text after the comma(,) exclude with the one in bracket
regex.match >> ,.\d{1,4}.
Here few example of text written in 1 row.

1 Noodle Curry Set 面咖喱套餐 [1 Taufu Pork 豆腐肉, 1 Bitter Gourd Pork 苦瓜肉, 1 Stuffed Taufu Skin Pork 腐皮肉, 1 Cabbage (Small) 小白菜]
1 Noodle Dry Set 面干捞套餐 [1 Taufu Fish 豆腐鱼, 1 Steamed Tauhu Fish 水豆腐鱼, 1 Taufu Pork 豆腐肉, 1 Cabbage (Small) 小白菜, 1 Dumpling 水饺]
1 Handmade Noodle Dry Set 手工面干捞套餐 [1 Taufu Fish 豆腐鱼, 1 Okra Pork 羊角豆肉, 1 Amaranth 苋菜, 1 Eggplant Pork 矮瓜肉], 1 Mee Hoon Dry Set 米粉干捞套餐 [1 Taufu Fish 豆腐鱼, 1 Okra Pork 羊角豆肉, 1 Taufu Pork 豆腐肉, 1 Amaranth 苋菜]
1 Roti Canai, 20 Roti Bawang Telur, 1 Kari Daging, 1 Teh
1 Ayam Kurma Set [1 Sambal Goreng], 1 Nescafe, 1 Teh
1 Special Fried Rice, 1 Special Fried Kuey Teow (Chicken Egg) [1 Sawi Jepun Goreng], 1 Special Fried Mee Hoon (Chicken Egg) [1 Sawi Jepun Goreng]

i have try it but still match with the one with the comma in bracket
Need help

Thanks.

hi, what do you want to split the text to? do you want all the result to be in separate columns like this?

image

Hi @jack.chan

Yes, want to split the text but write in next row instead column.

for example
from
1 Ayam Kurma Set [1 Sambal Goreng], 1 Nescafe, 1 Teh
to
1 Ayam Kurma Set [1 Sambal Goreng]
1 Nescafe
1 Teh

@Amin - This pattern captures everything except a comma…

I didn’t get your other requirement…Could you please explain?

Hi @prasath17

the other requirement is text inside the bracket that contain comma is not included

for example
FROM
1 Noodle Curry Set 面咖喱套餐 [1 Taufu Pork 豆腐肉, 1 Bitter Gourd Pork 苦瓜肉, 1 Stuffed Taufu Skin Pork 腐皮肉, 1 Cabbage (Small) 小白菜], 1 Noodle Dry Set 面干捞套餐 [1 Taufu Fish 豆腐鱼, 1 Steamed Tauhu Fish 水豆腐鱼, 1 Taufu Pork 豆腐肉, 1 Cabbage (Small) 小白菜, 1 Dumpling 水饺]
TO
1 Noodle Curry Set 面咖喱套餐 [1 Taufu Pork 豆腐肉, 1 Bitter Gourd Pork 苦瓜肉, 1 Stuffed Taufu Skin Pork 腐皮肉, 1 Cabbage (Small) 小白菜],
1 Noodle Dry Set 面干捞套餐 [1 Taufu Fish 豆腐鱼, 1 Steamed Tauhu Fish 水豆腐鱼, 1 Taufu Pork 豆腐肉, 1 Cabbage (Small) 小白菜, 1 Dumpling 水饺]

thank

Hi @jack.chan , Sorry still not clear.

Hi @prasath17 he means do NOT split the commas that are inside square brackets
e.g. A[1,2,3],B[4,5,6] will become
A[1,2,3]
B[4,5,6]

Hi,

I think we need more accurate expected output. For now, can you try the following expression?

"[^,\[\]]+(\[.*?\])*"

or

"([^,\[\]]+(\[.*?\])*)+"

Here is sample workflow for the above.

Main.xaml (9.1 KB)

Regards.

2 Likes

Hi @Yoichi

It works for me…
I use pattern 1

Thanks…
Awesome

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.