Skip to content

Instantly share code, notes, and snippets.

@henrik
Created December 19, 2011 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrik/1499164 to your computer and use it in GitHub Desktop.
Save henrik/1499164 to your computer and use it in GitHub Desktop.
>> "1 a b".scan(/[[:alpha:]]/)
=> ["a", "b"]
>> "1 a b".scan(/[:alpha:]/)
=> ["a"]
>> "1 a b".scan(/[\s]/)
=> [" ", " "]
>> "1 a b".scan(/\s/)
=> [" ", " "]
@henrik
Copy link
Author

henrik commented Dec 20, 2011

Ah, @infixfilip figured it out! https://twitter.com/filip/status/149064513122074624

Line 3 is simply interpreted as /[alp:]/ or /(a|l|p|:)/, not as a character class.

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