[#86787] [Ruby trunk Feature#14723] [WIP] sleepy GC — ko1@...

Issue #14723 has been updated by ko1 (Koichi Sasada).

13 messages 2018/05/01
[#86790] Re: [Ruby trunk Feature#14723] [WIP] sleepy GC — Eric Wong <normalperson@...> 2018/05/01

ko1@atdot.net wrote:

[#87095] [Ruby trunk Feature#14767] [PATCH] gc.c: use monotonic counters for objspace_malloc_increase — ko1@...

Issue #14767 has been updated by ko1 (Koichi Sasada).

9 messages 2018/05/17
[#87096] Re: [Ruby trunk Feature#14767] [PATCH] gc.c: use monotonic counters for objspace_malloc_increase — Eric Wong <normalperson@...> 2018/05/17

ko1@atdot.net wrote:

[ruby-core:87281] [Ruby trunk Bug#14791] String.sub wrong parsing of replacement with capturing group

From: hanmac@...
Date: 2018-05-28 15:25:10 UTC
List: ruby-core #87281
Issue #14791 has been updated by Hanmac (Hans Mackowiak).


need 5 or 6 (6 when using ")

~~~ ruby
"abc".sub(/(b)/, '\\\\\1') #=> "a\\bc"
"abc".sub(/(b)/, "\\\\\1") #=> "a\\\x01c"
"abc".sub(/(b)/, "\\\\\\1") #=> "a\\bc"
~~~


but be careful that irb returns inspected value, that is important if you want to see \ or \\ stuff

~~~ ruby
puts "abc".sub(/(b)/, '\\\\\1') #=> a\bc
p "abc".sub(/(b)/, '\\\\\1') #=> a\\bc
~~~


----------------------------------------
Bug #14791: String.sub wrong parsing of replacement with capturing group
https://bugs.ruby-lang.org/issues/14791#change-72269

* Author: churib (Timo Grodzinski)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
~~~ ruby
irb(main):001:0> "abc".sub(/(b)/, '#\1#') # works
=> "a#b#c"
irb(main):002:0> "abc".sub(/(b)/, '\\1') # doesn't works, should be "a\bc"
=> "abc"
irb(main):003:0> "abc".sub(/(b)/, '\\\1') # doesn't works, should be "a\\bc"
=> "a\\1c"
irb(main):004:0> "abc".sub(/(b)/, "\\1") # works
=> "abc"
irb(main):005:0> "abc".sub(/(b)/, "\\\\1") # doesn't works, should be "a\bc"
=> "a\\1c"
irb(main):006:0> "abc".sub(/(b)/, '\ \1') # works
=> "a\ bc"
~~~




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next