specify ranges of characters inside the square brackets : scan « String « Ruby
- Ruby
- String
- scan
specify ranges of characters inside the square brackets
# This scan matches all lowercase letters between a and m.
"This is a test".scan(/[a-m]/) { |x| puts x }
Related examples in the same category