From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2003-04-08T02:09:15+09:00 Subject: Re: ruby-dev summary 19944 - 19957 In article , ahoward wrote: >On Tue, 8 Apr 2003, Brian Candler wrote: > >> On Tue, Apr 08, 2003 at 12:20:40AM +0900, Kazuo Saito wrote: >> > They plan to change the regexp parsing rule in 1.8.0 as follows so far. >> > The plan is based on regexp coding conventions and requests from others >> > in ruby-dev: >> .. >> > 2) A literal '-' in a character class should be escaped too if the >> > class has other '-' literals for range representation. For instance, >> > /[abcd-f-hijk]/ and /[--abc]/ should be written as >> > /[abcd-f\-hijk]/ (or /[abcd\-f-hijk]/) and /[\--abc]/. >> > You can use '-' without '\' if the class has no ranges, like >> > /[-abc]/ or /[^-]/. >> >> The way I parse regexps in my brain is the way I have been conditioned >> through what I have learned with grep, awk, perl and so on :-) >> >> I often use character classes like this: >> >> /[a-zA-Z0-9.-]/ >> >> which matches a-z, A-Z, 0-9, dot or dash. This is how it works everywhere >> else. The rule is 'if you want to match a dash, put it at the very beginning >> or very end of your character class' >> >> I can't see any particular reason to outlaw this practice... > >i'm with brian on this - those of us who've been converting old lex/perl >parsers to ruby have enough trouble saving the regexes people took hours to >write. backward compatibility in something as arcane as regexes is not just >nice - it's essential. > Well said. I agree completely. Please do not break backward compatibility of regexes - doing so could seriously scare people away from Ruby since they would never know if their code will work with the next release without having to be rewritten. Phil