From: brabuhr@... Date: 2007-02-03T07:29:31+09:00 Subject: Re: bug is ruby regexp On 2/2/07, James Edward Gray II wrote: > On Feb 2, 2007, at 9:54 AM, Nick Black wrote: > > I spotted this problem in ruby's regexp today: ... > > > > (irb):2: invalid regular expression: /[9-13]/ > > from (irb):4 > > from :0 > > irb(main):005:0> > > A character class ([...]) with a range of 9-1 is not valid in a > regular expression because 1 does not come after 9 in your character > encoding. For comparative reference: $ perl -e 'print "foo" if 9 =~ /[9-13]/' Invalid [] range "9-1" in regex; marked by <-- HERE in m/[9-1 <-- HERE 3]/ at -e line 1. $ python -c "import re; re.match('[9-13]', '9')" Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/sre.py", line 129, in match return _compile(pattern, flags).match(string) File "/usr/lib/python2.4/sre.py", line 227, in _compile raise error, v # invalid expression sre_constants.error: bad character range