in reply to Is there any regex limitation?
Here's a demonstration of CSV parsing in Perl using Text::CSV_XS.
#!perl use strict; use warnings; use Text::CSV_XS; my $csv = Text::CSV_XS->new( { binary => 1 } ); while (my $record = $csv->getline(*DATA)) { my @values = @$record; for (my $i = 0; $i <= $#values; $i++) { printf "(%d)\t[%s]\n", $i + 1, $values[$i]; } } exit 0; __DATA__ Action,userID,DEPT,FolderLocation,Place,First Name,Surname,Dept2,subje +ct,brief,Phone,InternetEmail,AccessCode,AccessID,A,IA,SC,UC,PC,JD,ED, +JC,G,SCA,FNA,OAD,AAK,MBB,SACTA,Index,STATE,Fax,uID,LDisa,Second Intro +,BossName,EXphoneCall,OXCode,NameID,Section,Com,status,final Am,Speci +alID,unit,BFIT,Old Show,Second mail alias,footer,Build,Notes Server,C +ellPhone X,LLXEAS2,,,"Wah Woo, Section A",Lamshi,Coo,DSA,No vell,,,,,,,,,,HKA,, +,,,,,,,,,,Important,,,,,,,A,LLXEAS2,CWW,,NAW,,,,,,,"Welcome to Coo Du +k, ltd.",,, X,LLXEAS,,,"Wah Woo, Section A",Lamshi,Coo,DSA,No vell,,,,,,,,,,HKA,,, +,,,,,,,,,Important,,,,,,,A,LLXEAS,CWW,,NAW,,,,,,,"Welcome to Coo Duk, + ltd.",,, G,CHXAS,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,sam.mo@hotmail.co +m,,,,
Here's the output of the script.
(1) [Action] (2) [userID] (3) [DEPT] (4) [FolderLocation] (5) [Place] (6) [First Name] (7) [Surname] (8) [Dept2] (9) [subject] (10) [brief] (11) [Phone] (12) [InternetEmail] (13) [AccessCode] (14) [AccessID] (15) [A] (16) [IA] (17) [SC] (18) [UC] (19) [PC] (20) [JD] (21) [ED] (22) [JC] (23) [G] (24) [SCA] (25) [FNA] (26) [OAD] (27) [AAK] (28) [MBB] (29) [SACTA] (30) [Index] (31) [STATE] (32) [Fax] (33) [uID] (34) [LDisa] (35) [Second Intro] (36) [BossName] (37) [EXphoneCall] (38) [OXCode] (39) [NameID] (40) [Section] (41) [Com] (42) [status] (43) [final Am] (44) [SpecialID] (45) [unit] (46) [BFIT] (47) [Old Show] (48) [Second mail alias] (49) [footer] (50) [Build] (51) [Notes Server] (52) [CellPhone] (1) [X] (2) [LLXEAS2] (3) [] (4) [] (5) [Wah Woo, Section A] (6) [Lamshi] (7) [Coo] (8) [DSA] (9) [No vell] (10) [] (11) [] (12) [] (13) [] (14) [] (15) [] (16) [] (17) [] (18) [] (19) [HKA] (20) [] (21) [] (22) [] (23) [] (24) [] (25) [] (26) [] (27) [] (28) [] (29) [] (30) [] (31) [Important] (32) [] (33) [] (34) [] (35) [] (36) [] (37) [] (38) [A] (39) [LLXEAS2] (40) [CWW] (41) [] (42) [NAW] (43) [] (44) [] (45) [] (46) [] (47) [] (48) [] (49) [Welcome to Coo Duk, ltd.] (50) [] (51) [] (52) [] (1) [X] (2) [LLXEAS] (3) [] (4) [] (5) [Wah Woo, Section A] (6) [Lamshi] (7) [Coo] (8) [DSA] (9) [No vell] (10) [] (11) [] (12) [] (13) [] (14) [] (15) [] (16) [] (17) [] (18) [] (19) [HKA] (20) [] (21) [] (22) [] (23) [] (24) [] (25) [] (26) [] (27) [] (28) [] (29) [] (30) [] (31) [Important] (32) [] (33) [] (34) [] (35) [] (36) [] (37) [] (38) [A] (39) [LLXEAS] (40) [CWW] (41) [] (42) [NAW] (43) [] (44) [] (45) [] (46) [] (47) [] (48) [] (49) [Welcome to Coo Duk, ltd.] (50) [] (51) [] (52) [] (1) [G] (2) [CHXAS] (3) [] (4) [] (5) [] (6) [] (7) [] (8) [] (9) [] (10) [] (11) [] (12) [] (13) [] (14) [] (15) [] (16) [] (17) [] (18) [] (19) [] (20) [] (21) [] (22) [] (23) [] (24) [] (25) [] (26) [] (27) [] (28) [] (29) [] (30) [] (31) [] (32) [] (33) [] (34) [] (35) [] (36) [] (37) [] (38) [] (39) [] (40) [] (41) [] (42) [] (43) [] (44) [] (45) [] (46) [] (47) [] (48) [sam.mo@hotmail.com] (49) [] (50) [] (51) [] (52) []
Neither your regular expression pattern nor split will parse your example CSV records correctly.
|
|---|