Regular Expression to break row with comma separated values into distinct rows
        Posted  
        
            by Nick
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Nick
        
        
        
        Published on 2010-05-09T10:01:45Z
        Indexed on 
            2010/05/09
            10:08 UTC
        
        
        Read the original article
        Hit count: 356
        
regex
|comma-separated
I have a file with many rows. Each row has a column which may contain comma separated values. I need each row to be distinct (ie no comma separated values).
Here is an example row:
AB AB10,AB11,AB12,AB15,AB16,AB21,AB22,AB23,AB24,AB25,AB99 ABERDEEN Aberdeenshire
The columns are comma separated (Postcode area, Postcode districts, Post town, Former postal county).
So the above row would get turned into:
AB AB10 ABERDEEN Aberdeenshire AB AB11 ABERDEEN Aberdeenshire AB AB12 ABERDEEN Aberdeenshire ... ...
I tried the following but it didn't work...
(.+)\t(([0-9A-Z]+),)+\t(.+)\t(.+)
© Stack Overflow or respective owner