我有一个像'[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