Forum Discussion
Hi tlikarish,
I have tried the approach you have suggested, since as you see in the attached snapshot the record spans over multiple line and there is only CR in one of the columns in between, I have changed the expression to replace -$content.toString().replace(‘\r’, ’ '), by this the records did not get loaded properly, the records was still not considered as single record.
Can you let us know if we need to do something else
Thanks
Regards
smitha csvparser.zip (25.5 KB)
Are you seeing an error message? Since you’re using quotes and the column is quoted, the CSV Parser should treat the carriage return as part of the column’s value and not as a row delimiter. Is it possible the quoting is off?
- tlikarish6 years agoEmployee
Doh – also messed up with the expression I gave you.
$content.toString().replace('\r', ' ')
Only replaces the first match. You should probably use
replaceAll
or change the regular expression to/\r/g
. This will replace all carriage returns, so if the lines are delimited with\r\n
, then you’d have to use something like/\r(?!\n)/g
, which would remove all carriage returns not followed by a line feed. - Matt6 years agoNew Contributor
What if we aren’t using quotes?
- tlikarish6 years agoEmployee
Although I haven’t tried it, I think this expression should work even if your data isn’t quoted.