churib (Timo Grodzinski)
- Login: churib
- Registered on: 05/28/2018
- Last sign in: 05/28/2018
Issues
| open | closed | Total | |
|---|---|---|---|
| Assigned issues | 0 | 0 | 0 |
| Reported issues | 0 | 1 | 1 |
Activity
05/29/2018
-
09:41 AM Ruby Bug #14791: String.sub wrong parsing of replacement with capturing group
- Thanks for help!
I don't unterstand, why five backslahes are required in single quotes. My understanding was that characters in single quotes won't get interpolated so two backslashes should be sufficient.
05/28/2018
-
02:28 PM Ruby Bug #14791: String.sub wrong parsing of replacement with capturing group
- Can you give a solution for my second example?
~~~ ruby
"abc".sub(/(b)/, '\\1') # doesn't works, should be "a\bc"
~~~
I want to replace the 'b' with '\b'. How many backslashes do I need?
The #sub method has problems with consecuti... -
01:44 PM Ruby Bug #14791 (Rejected): String.sub wrong parsing of replacement with capturing group
- ~~~ 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"
...