"Robert Gustavsson" <robertg / swipnet.se> writes:

> I've tried to use character classes in Ruby regular expressions, like:
> 
>  str = "d12345d"
>  x = str.scan( /[:digit:]+/ )
>  print x, "\n"
> 
> The above code displays dd. It seems that Ruby interprets [] as a the list
> op and not the character class op. Or have I missed something? I looked in
> the source (regex.c). Maybe the character class support has been turned off
> in Ruby?

  str = "d12345d"               	# => "d12345d"
  str.scan( /[[:digit:]]+/ )		# => ["12345"]


Them brackets'll get you every time. btw. I believe Matz is
deprecating the :xxx: character classes (which is why we didn't
document them).


Regards


Dave