Hi,

In message "Re: ruby-dev summary  19944 - 19957"
    on 03/04/08, Brian Candler <B.Candler / pobox.com> writes:

|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'

It does (and will) works so in Ruby too.  The dash in the character
class here is not confusing.  Remember examples in [ruby-talk:68760]:

   /[abcd-f-hijk]/

   The second dash in *not* a part of range; should be escaped,
   warning.  Note that it's not an error.

   /[--abc]/

   The first dash is the beginning of character range; should be
   escaped, warning.

   /[-abc]/

   The first dash is apparently not part of character range; no
   confusing, no warning.

   /[abc-]/

   The dash at the end of character class is apparently not part of
   character range; no confusing, no warning.

   /[^-]/

   The first dash is apparently not part of character range; no
   confusing, no warning.

   /a]/

   The closing bracket is not part of character class; should be
   escaped, warning.

|I can't see any particular reason to outlaw this practice...

We are not going to outlaw them.  We want to discourage them by giving
warning.

							matz.