我有一個像'[1] - [2] - [3],[4] - [5],[6,7,8],[9]'或'[Computers ] - [蘋果] - [筆記本電腦],[電纜] - [電纜,連接器],[適配器],我希望模式獲得列表結果,但不知道如何弄清楚模式。基本上逗號是分割,但[6,7,8]本身也包含逗號。使用正則表達式分割字符串
the string: [1]-[2]-[3],[4]-[5],[6,7,8],[9]
the result:
[1]-[2]-[3]
[4]-[5]
[6,7,8]
[9]
or
the string: [Computers]-[Apple]-[Laptop],[Cables]-[Cables,Connectors],[Adapters]
the result:
[Computers]-[Apple]-[Laptop]
[Cables]-[Cables,Connectors]
[Adapters]
你可以給這個代碼樣本輸出? – 2013-03-23 04:43:29
分割'',['。 – 2013-03-23 04:44:00
哦,我明白了。這不是真正的正則表達式,你可以使用簡單的分割。 – 2013-03-23 04:44:33