ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:108122] [Ruby master Bug#18670] MatchData#[start, length] pads nil values when negative start is given
@ 2022-03-30 16:30 bjfish (Brandon Fish)
  2022-03-31  6:35 ` [ruby-core:108131] " nobu (Nobuyoshi Nakada)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bjfish (Brandon Fish) @ 2022-03-30 16:30 UTC (permalink / raw)
  To: ruby-core

Issue #18670 has been reported by bjfish (Brandon Fish).

----------------------------------------
Bug #18670: MatchData#[start, length] pads nil values when negative start is given
https://bugs.ruby-lang.org/issues/18670

* Author: bjfish (Brandon Fish)
* Status: Open
* Priority: Normal
* ruby -v: 3.0.3
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------

Example
``` ruby
irb(main):001:0> /(.)(.)(\d+)(\d)/.match("THX1138.")[-1, 10]
=> ["8", nil, nil, nil, nil, nil, nil, nil, nil, nil]
```

I would expect this to be consistent with String or Array for example:
``` ruby
irb(main):002:0> "hello"[-1, 10]
=> "o"
irb(main):003:0> [1,2,3][-1,10]
=> [3]
```




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:108131] [Ruby master Bug#18670] MatchData#[start, length] pads nil values when negative start is given
  2022-03-30 16:30 [ruby-core:108122] [Ruby master Bug#18670] MatchData#[start, length] pads nil values when negative start is given bjfish (Brandon Fish)
@ 2022-03-31  6:35 ` nobu (Nobuyoshi Nakada)
  2022-03-31  6:46 ` [ruby-core:108132] " nobu (Nobuyoshi Nakada)
  2022-09-04  7:25 ` [ruby-core:109836] " nagachika (Tomoyuki Chikanaga)
  2 siblings, 0 replies; 4+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2022-03-31  6:35 UTC (permalink / raw)
  To: ruby-core

Issue #18670 has been updated by nobu (Nobuyoshi Nakada).

Backport changed from 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN to 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED

It is since 2.4.0.

----------------------------------------
Bug #18670: MatchData#[start, length] pads nil values when negative start is given
https://bugs.ruby-lang.org/issues/18670#change-97106

* Author: bjfish (Brandon Fish)
* Status: Open
* Priority: Normal
* ruby -v: 3.0.3
* Backport: 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED
----------------------------------------

Example
``` ruby
irb(main):001:0> /(.)(.)(\d+)(\d)/.match("THX1138.")[-1, 10]
=> ["8", nil, nil, nil, nil, nil, nil, nil, nil, nil]
```

I would expect this to be consistent with String or Array for example:
``` ruby
irb(main):002:0> "hello"[-1, 10]
=> "o"
irb(main):003:0> [1,2,3][-1,10]
=> [3]
```




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:108132] [Ruby master Bug#18670] MatchData#[start, length] pads nil values when negative start is given
  2022-03-30 16:30 [ruby-core:108122] [Ruby master Bug#18670] MatchData#[start, length] pads nil values when negative start is given bjfish (Brandon Fish)
  2022-03-31  6:35 ` [ruby-core:108131] " nobu (Nobuyoshi Nakada)
@ 2022-03-31  6:46 ` nobu (Nobuyoshi Nakada)
  2022-09-04  7:25 ` [ruby-core:109836] " nagachika (Tomoyuki Chikanaga)
  2 siblings, 0 replies; 4+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2022-03-31  6:46 UTC (permalink / raw)
  To: ruby-core

Issue #18670 has been updated by nobu (Nobuyoshi Nakada).


https://github.com/ruby/ruby/pull/5740

----------------------------------------
Bug #18670: MatchData#[start, length] pads nil values when negative start is given
https://bugs.ruby-lang.org/issues/18670#change-97107

* Author: bjfish (Brandon Fish)
* Status: Open
* Priority: Normal
* ruby -v: 3.0.3
* Backport: 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED
----------------------------------------

Example
``` ruby
irb(main):001:0> /(.)(.)(\d+)(\d)/.match("THX1138.")[-1, 10]
=> ["8", nil, nil, nil, nil, nil, nil, nil, nil, nil]
```

I would expect this to be consistent with String or Array for example:
``` ruby
irb(main):002:0> "hello"[-1, 10]
=> "o"
irb(main):003:0> [1,2,3][-1,10]
=> [3]
```




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:109836] [Ruby master Bug#18670] MatchData#[start, length] pads nil values when negative start is given
  2022-03-30 16:30 [ruby-core:108122] [Ruby master Bug#18670] MatchData#[start, length] pads nil values when negative start is given bjfish (Brandon Fish)
  2022-03-31  6:35 ` [ruby-core:108131] " nobu (Nobuyoshi Nakada)
  2022-03-31  6:46 ` [ruby-core:108132] " nobu (Nobuyoshi Nakada)
@ 2022-09-04  7:25 ` nagachika (Tomoyuki Chikanaga)
  2 siblings, 0 replies; 4+ messages in thread
From: nagachika (Tomoyuki Chikanaga) @ 2022-09-04  7:25 UTC (permalink / raw)
  To: ruby-core

Issue #18670 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED to 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE

ruby_3_1 1cfc139f6d0cb80d6024b0c416976194929417cf merged revision(s) d8189ed23f02dd197453279aeee9be1785337d4f.

----------------------------------------
Bug #18670: MatchData#[start, length] pads nil values when negative start is given
https://bugs.ruby-lang.org/issues/18670#change-99073

* Author: bjfish (Brandon Fish)
* Status: Closed
* Priority: Normal
* ruby -v: 3.0.3
* Backport: 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE
----------------------------------------

Example
``` ruby
irb(main):001:0> /(.)(.)(\d+)(\d)/.match("THX1138.")[-1, 10]
=> ["8", nil, nil, nil, nil, nil, nil, nil, nil, nil]
```

I would expect this to be consistent with String or Array for example:
``` ruby
irb(main):002:0> "hello"[-1, 10]
=> "o"
irb(main):003:0> [1,2,3][-1,10]
=> [3]
```




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-04  7:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30 16:30 [ruby-core:108122] [Ruby master Bug#18670] MatchData#[start, length] pads nil values when negative start is given bjfish (Brandon Fish)
2022-03-31  6:35 ` [ruby-core:108131] " nobu (Nobuyoshi Nakada)
2022-03-31  6:46 ` [ruby-core:108132] " nobu (Nobuyoshi Nakada)
2022-09-04  7:25 ` [ruby-core:109836] " nagachika (Tomoyuki Chikanaga)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).