Last active
February 5, 2023 21:45
-
-
Save ObjectBoxPC/676b67b734cd1ac3995e56063378f510 to your computer and use it in GitHub Desktop.
Confusion about Ruby Regexp \p{Word} character class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby --version | |
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu] | |
$ irb | |
irb(main):001:0> /\p{Word}/.match?("\u00B2") # Expected to be true based on description of \p{Word} in Regexp docs | |
=> false | |
irb(main):002:0> /\p{Number}/.match?("\u00B2") # U+00B2 is a Number character | |
=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I opened a bug report here: https://bugs.ruby-lang.org/issues/19417