iamtheky Posted March 20, 2015 Share Posted March 20, 2015 but you are using single quotes to enclose? so this string $sString = '"1", '''''''''', hello world' & @LF & '(*), "1,2,3,4,5", "@", "4TH"' & @LF & '"2", """""""""", hello 2 world , "4TH" , "5TH"' & @LF You would get half of the single quotes and all of the double quotes. I didnt gather what the desired outcome in that instance would be. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
czardas Posted March 20, 2015 Share Posted March 20, 2015 (edited) We have fields enclosed in double quotes: ,"field" becomes ==> field ; You can have double quotes within fields enclosed in double quotes: ,"""field""" becomes ==> "field" ,"""""" becomes ==> "" : Fields can also contain line breaks: ,"A B" becomes ==> A B Edited March 20, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
iamtheky Posted March 20, 2015 Share Posted March 20, 2015 Ah yes, The csv rules. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
czardas Posted March 20, 2015 Share Posted March 20, 2015 boththose et al - The test string I wrote was invalid csv format. @Jewtus I put back the original code I posted the first time. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Jewtus Posted March 23, 2015 Author Share Posted March 23, 2015 (edited) FYI, This is the line the Parse CSV chokes on: Local $aREgex = StringRegExp($sFile, $sPattern, 3) I hear you all talking about escaping double quotes, but why would it only fail on one of the two records? Is the content of the record too long? @UEZ If you open the file in notepad++ and do a regex replace on n you can see the two records as single lines each. @BrewManNH I think you might be right with the stack overflow... Is there a way to tell? Just delete some of the text? The only real difference I can see is the the column in the first record is 9173 characters and the second is 4091 (ignoring CRs and LFs) EDIT: This did work: Local $aArray = _CSVSplit(FileRead($filename),",") _ArrayDisplay($aArray) Edited March 23, 2015 by Jewtus czardas 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now