A
Alfredo Mesen
Hello, I've been trying to monkey patch FCSV to allow escaped colsep
characters within a field:
FCSV.parse "here\\, it is, other fields" #need: [["here\\, it is",
"other fields"]]
^
So what I tried was modifying the :csv_row regexp on the init_parsers
method
1797: ([^#{esc_quote}#{esc_col_sep}]*) # unquoted fields
which I changed with this:
1797: ((?>[^#{esc_quote}#{esc_col_sep}]*
1798: \\#{esc_col_sep}
1799: [^#{esc_quote}#{esc_col_sep}]*)*) # unquoted fields
This didn't work though , though my gut tells me I'm close
Thanks in advance for any help with this
characters within a field:
FCSV.parse "here\\, it is, other fields" #need: [["here\\, it is",
"other fields"]]
^
So what I tried was modifying the :csv_row regexp on the init_parsers
method
1797: ([^#{esc_quote}#{esc_col_sep}]*) # unquoted fields
which I changed with this:
1797: ((?>[^#{esc_quote}#{esc_col_sep}]*
1798: \\#{esc_col_sep}
1799: [^#{esc_quote}#{esc_col_sep}]*)*) # unquoted fields
This didn't work though , though my gut tells me I'm close
Thanks in advance for any help with this