From: James Edward Gray II Date: 2004-11-18T12:55:24+09:00 Subject: Re: Regexp bug in 1.9.0? On Nov 17, 2004, at 9:47 PM, Francis Hwang wrote: > Is this behavior a bug, or am I misunderstanding how I should make a > regexp? > > irb(main):001:0> str = "123.456.*" > => "123.456.*" > irb(main):002:0> str =~ /^[0123456789.-*]+/ > SyntaxError: compile error > (irb):2: empty range in char class: /^[0123456789.-*]+/ > from (irb):2 > irb(main):003:0> str =~ /^[0123456789*.-]+/ > => 0 - is a special character inside a Regexp character class. It means, from this (character left of dash) to this (character right of dash). It's usually used to say A-Z, a-z, 0-9, or similar. Putting it at the beginning or end of a class negates this special meaning, thus the change in the second attempt. Did you really mean all characters from period to asterisk? James Edward Gray II