LoginSignup
64
58

More than 5 years have passed since last update.

正規表現クラス[:alnum:]の罠

Last updated at Posted at 2013-06-07

[:alnum:] って a-zA-Z0-9 と等価だと思っていたが違う。

てっきり

"ほげ".match(/[[:alnum:]]+/)   # => nil

となるのを期待していたのに、

"ほげ".match(/[[:alnum:]]+/)   # => #<MatchData "ほげ">

となる…なんだこれ?

64
58
13

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
64
58