* [ruby-dev:51182] [Ruby master Bug#18802] Negation of POSIX character class does not work
@ 2022-05-25 2:41 cohei
2022-05-25 3:02 ` [ruby-dev:51183] " mame (Yusuke Endoh)
2022-05-25 3:34 ` [ruby-dev:51184] " cohei
0 siblings, 2 replies; 3+ messages in thread
From: cohei @ 2022-05-25 2:41 UTC (permalink / raw)
To: ruby-dev
Issue #18802 has been reported by cohei (昂平 谷口).
----------------------------------------
Bug #18802: Negation of POSIX character class does not work
https://bugs.ruby-lang.org/issues/18802
* Author: cohei (昂平 谷口)
* Status: Open
* Priority: Normal
* ruby -v: 3.1.2
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
> https://docs.ruby-lang.org/ja/3.1/doc/spec=2fregexp.html#charclass_posix
> また、[:^クラス名:]という記法でその否定を意味します。
For example, `[:^ascii:]` is the negation of `[:ascii:]` according to the document. But it does not work:
```ruby
irb(main):001:0> RUBY_VERSION
=> "3.1.2"
irb(main):002:0> %w[あああ あ a b :].map { _1.match?(/[:^ascii:]/) }
=> [false, false, true, false, true] # matches a, c, i, s, : or ^
irb(main):003:0> %w[あああ あ a b :].map { _1.match?(/[^[:ascii:]]/) }
=> [true, true, false, false, false] # expected
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-dev:51183] [Ruby master Bug#18802] Negation of POSIX character class does not work
2022-05-25 2:41 [ruby-dev:51182] [Ruby master Bug#18802] Negation of POSIX character class does not work cohei
@ 2022-05-25 3:02 ` mame (Yusuke Endoh)
2022-05-25 3:34 ` [ruby-dev:51184] " cohei
1 sibling, 0 replies; 3+ messages in thread
From: mame (Yusuke Endoh) @ 2022-05-25 3:02 UTC (permalink / raw)
To: ruby-dev
Issue #18802 has been updated by mame (Yusuke Endoh).
Status changed from Open to Rejected
Note that the sentence is written in [the section of character class](https://docs.ruby-lang.org/ja/3.1/doc/spec=2fregexp.html#string). So `[:^ascii:]` must be used in a character class as follows:
```
irb(main):001:0> %w[あああ あ a b :].map { _1.match?(/[[:^ascii:]]/) }
=> [true, true, false, false, false]
```
If you want to improve the Japanese document, please contact on https://github.com/rurema/doctree/issues .
----------------------------------------
Bug #18802: Negation of POSIX character class does not work
https://bugs.ruby-lang.org/issues/18802#change-97731
* Author: cohei (昂平 谷口)
* Status: Rejected
* Priority: Normal
* ruby -v: 3.1.2
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
> https://docs.ruby-lang.org/ja/3.1/doc/spec=2fregexp.html#charclass_posix
> また、[:^クラス名:]という記法でその否定を意味します。
For example, `[:^ascii:]` is the negation of `[:ascii:]` according to the document. But it does not work:
```ruby
irb(main):001:0> RUBY_VERSION
=> "3.1.2"
irb(main):002:0> %w[あああ あ a b :].map { _1.match?(/[:^ascii:]/) }
=> [false, false, true, false, true] # matches a, c, i, s, : or ^
irb(main):003:0> %w[あああ あ a b :].map { _1.match?(/[^[:ascii:]]/) }
=> [true, true, false, false, false] # expected
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-dev:51184] [Ruby master Bug#18802] Negation of POSIX character class does not work
2022-05-25 2:41 [ruby-dev:51182] [Ruby master Bug#18802] Negation of POSIX character class does not work cohei
2022-05-25 3:02 ` [ruby-dev:51183] " mame (Yusuke Endoh)
@ 2022-05-25 3:34 ` cohei
1 sibling, 0 replies; 3+ messages in thread
From: cohei @ 2022-05-25 3:34 UTC (permalink / raw)
To: ruby-dev
Issue #18802 has been updated by cohei (昂平 谷口).
Thank you! I misunderstood about character classes.
----------------------------------------
Bug #18802: Negation of POSIX character class does not work
https://bugs.ruby-lang.org/issues/18802#change-97732
* Author: cohei (昂平 谷口)
* Status: Rejected
* Priority: Normal
* ruby -v: 3.1.2
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
> https://docs.ruby-lang.org/ja/3.1/doc/spec=2fregexp.html#charclass_posix
> また、[:^クラス名:]という記法でその否定を意味します。
For example, `[:^ascii:]` is the negation of `[:ascii:]` according to the document. But it does not work:
```ruby
irb(main):001:0> RUBY_VERSION
=> "3.1.2"
irb(main):002:0> %w[あああ あ a b :].map { _1.match?(/[:^ascii:]/) }
=> [false, false, true, false, true] # matches a, c, i, s, : or ^
irb(main):003:0> %w[あああ あ a b :].map { _1.match?(/[^[:ascii:]]/) }
=> [true, true, false, false, false] # expected
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-25 3:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25 2:41 [ruby-dev:51182] [Ruby master Bug#18802] Negation of POSIX character class does not work cohei
2022-05-25 3:02 ` [ruby-dev:51183] " mame (Yusuke Endoh)
2022-05-25 3:34 ` [ruby-dev:51184] " cohei
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 NNTP newsgroup(s).