-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Add entry for backslash_quotes liberal parsing #280
Conversation
|
||
With +liberal_parsing+ and its +backslash_quote+ sub-option: | ||
ary = CSV.parse_line(str, liberal_parsing: { backslash_quotes: true }) | ||
ary # => ["Show", "Harold \"Handcuff\" Houdini", "Tampa Theater"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the result is incorrect.
Could you check this again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kou Thanks for catching that. I thought I had copied and pasted, but apparently not. backslash_quotes: true
should be backslash_quote: true
. I'll resubmit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a console log:
~/code/csv/doc/csv/options/parsing git:(doc/add-liberal-parsing) docker run -it 1e6b2a26f38d bash
root@d277469b2d78:/# irb
irb(main):001:0> require 'csv'
=> true
irb(main):002:0> RUBY_VERSION
=> "3.2.0"
irb(main):003:0> str = 'Show,"Harry \"Handcuff\" Houdini, the one and only","Tampa Theater"'
=> "Show,\"Harry \\\"Handcuff\\\" Houdini, the one and only\",\"Tampa Theater\""
irb(main):004:0> ary = CSV.parse_line(str, liberal_parsing: true)
=> ["Show", "\"Harry \\\"Handcuff\\\" Houdini", " the one and only\"", "Tampa Theater"]
irb(main):005:0> puts ary[1]
"Harry \"Handcuff\" Houdini
=> nil
irb(main):006:0>
irb(main):007:0> ary = CSV.parse_line(str, liberal_parsing: { backslash_quote: true })
=> ["Show", "Harry \"Handcuff\" Houdini, the one and only", "Tampa Theater"]
irb(main):008:0> puts ary[1]
Harry "Handcuff" Houdini, the one and only
=> nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also update the results?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. I resubmitted just now.
f5e3a8b
to
43feb3a
Compare
43feb3a
to
b6b4627
Compare
Thanks! |
No description provided.