Skip to content

Instantly share code, notes, and snippets.

@ObjectBoxPC
Last active February 5, 2023 21:45
Show Gist options
  • Save ObjectBoxPC/676b67b734cd1ac3995e56063378f510 to your computer and use it in GitHub Desktop.
Save ObjectBoxPC/676b67b734cd1ac3995e56063378f510 to your computer and use it in GitHub Desktop.
Confusion about Ruby Regexp \p{Word} character class
$ 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
@ObjectBoxPC
Copy link
Author

I opened a bug report here: https://bugs.ruby-lang.org/issues/19417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment