Skip to content

Commit 405c3c9

Browse files
committed
fix(process_array): added a regex to cover most separators
1 parent 452613e commit 405c3c9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/ingestors/csv_ingestion.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ def process_description(row, header)
1515
end
1616

1717
def process_array(row, header)
18-
row[header].to_s.lstrip.split(/;/).reject(&:empty?).compact unless row[header].nil?
18+
# split by: comma or semicolon, optionally surrounded by whitespace
19+
# or two or more whitespace characters
20+
# any number of newline characters
21+
split_regex = /\s*[,;]\s*|\s{2,}|[\r\n]+/x
22+
row[header].to_s.lstrip.split(split_regex).reject(&:empty?).compact unless row[header].nil?
1923
end
2024

2125
def get_column(row, header)

0 commit comments

Comments
 (0)