In recent CVS versions of Ruby 1.9 the behaviour of code like:
Regexp.new("$*")
has changewd from
test-regexp-new.rb:2:in `initialize': target of repeat operator is \
invalid: /$*/ (RegexpError)
from test-regexp-new.rb:2:in `new'
from test-regexp-new.rb:2
to
test-regexp-new-2.rb:2: target of repeat operator is invalid: /$*/
i.e. from an exception to a compile error. Isn't this wrong?
The patch below restores the old behaviour (if I understand the
code correctly). Is the patch correct?
/Johan Holmberg
Index: re.c
===================================================================
RCS file: /src/ruby/re.c,v
retrieving revision 1.133
diff -u -r1.133 re.c
--- re.c 4 Nov 2004 14:43:08 -0000 1.133
+++ re.c 16 Nov 2004 22:38:18 -0000
@@ -1760,7 +1760,7 @@
s = StringValuePtr(argv[0]);
len = RSTRING(argv[0])->len;
}
- rb_reg_initialize(self, s, len, flags, Qtrue);
+ rb_reg_initialize(self, s, len, flags, Qfalse);
return self;
}