From: me@... Date: 2016-08-29T21:11:30+00:00 Subject: [ruby-core:77099] [Ruby trunk Bug#12712] IRB won't work after input `%q_abc\_def\_ghi_` Issue #12712 has been reported by Junichi Ito. ---------------------------------------- Bug #12712: IRB won't work after input `%q_abc\_def\_ghi_` https://bugs.ruby-lang.org/issues/12712 * Author: Junichi Ito * Status: Open * Priority: Normal * Assignee: * ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- After inputting `%q_abc\_def\_ghi_` in IRB, I get no response and have to stop with Ctrl-C. Here is the example: ~~~ ��� ~ irb irb(main):001:0> %q_abc\_def\_ghi_ irb(main):002:1> 123 irb(main):003:1> exit irb(main):004:1> irb(main):005:1* irb(main):006:1* ^C ~~~ But `%q_abc\_aaa\_ghi_` returns the value immediately: ~~~ ��� ~ irb irb(main):001:0> %q_abc\_aaa\_ghi_ => "abc_aaa_ghi" irb(main):002:0> ~~~ `%Q_abc\_def\_ghi_` is also okay: ~~~ ��� ~ irb irb(main):001:0> %Q_abc\_def\_ghi_ => "abc_def_ghi" irb(main):002:0> ~~~ `%q_abc\_def_` is also okay: ~~~ ��� ~ irb irb(main):001:0> %q_abc\_def_ => "abc_def" irb(main):002:0> ~~~ It seems IRB can't handle `def` string in the middle of %q notation properly. You can read some discussions here: http://stackoverflow.com/questions/39197026/escaping-in-q-notation-wont-work-in-irb And when I create a .rb file and run it with `ruby` command, it can escape `\_def` properly: ~~~ # test.rb puts %q_abc\_def\_ghi_ ~~~ ~~~ ��� ~ ruby test.rb abc_def_ghi ��� ~ ~~~ So I think the right behavior should be like this: ~~~ ��� ~ irb irb(main):001:0> %q_abc\_def\_ghi_ => "abc_def_ghi" ~~~ -- https://bugs.ruby-lang.org/ Unsubscribe: