Grouping string by comma between brackets

Posted by Myra on Stack Overflow See other posts from Stack Overflow or by Myra
Published on 2010-04-16T08:50:17Z Indexed on 2010/04/16 8:53 UTC
Read the original article Hit count: 231

Filed under:
|

Response to : http://stackoverflow.com/questions/1454913/regular-expression-to-find-a-string-included-between-two-characters-while-exclud

Hi,I'm looking for a regex pattern that applies to my string including brackets:

[1,2,3,4,5] [abc,ef,g] [0,2,4b,y7]
could be anything including word,digit,non-word together or separated.

I wish to get the group between brackets by \[(.*?)\] but what is the regex pattern that will give me the group between brackets and sub-group strings separated by commas so that the result may be following ??

Group1 : [1,2,3,4,5]
 Group1: 1
 Group2: 2
 Group3: 3
 Group4: 4
 Group5: 5

Group2 : [abc,ef,g]
 Group1: abc
 Group2: ef
 Group3: g

etc ..

Thank you for your help

© Stack Overflow or respective owner

Related posts about regex

Related posts about c#