New 1.8-snapshot regex warning

I just installed the latest 1.8 snapshot from 3/27 and found that I now
get warnings from the following code:

regex = /[a-zA-Z_-]/

warning: character class has `-’ without escape

This syntax is allowable in perl, and has been fine in ruby until very
recently. I just wanted to point it out in case the change was
accidental.

Thanks,
-Brad

Hi,

···

In message “new 1.8-snapshot regex warning” on 03/03/29, Brad Hilton bhilton@vpop.net writes:

get warnings from the following code:

regex = /[a-zA-Z_-]/

warning: character class has `-’ without escape

This syntax is allowable in perl, and has been fine in ruby until very
recently. I just wanted to point it out in case the change was
accidental.

It’s not accidental. See ruby-dev summary next week. But I now think
it may be better to allow “-” at top or bottom of character classes.

						matz.

Seems that it’s the “usual” way of handling it, as per ed(1)
(don’t have POSIX at hand %) – so why break.

···

On Sat, Mar 29, 2003 at 09:33:34AM +0900, Yukihiro Matsumoto wrote:

regex = /[a-zA-Z_-]/
warning: character class has `-’ without escape
It’s not accidental. See ruby-dev summary next week. But I
now think it may be better to allow “-” at top or bottom of
character classes.


---- WBR, Michael Shigorin mike@altlinux.ru
------ Linux.Kiev http://www.linux.kiev.ua/

In article 20030329144039.GE2741@osdn.org.ua,
Michael Shigorin mike@osdn.org.ua writes:

Seems that it’s the “usual” way of handling it, as per ed(1)
(don’t have POSIX at hand %) – so why break.

It is intended to warn /[a-c-e]/.

···


Tanaka Akira