From: Jim Weirich Date: 2005-08-25T09:31:55+09:00 Subject: Re: regexp character classes and + Mark Volkmann said: > Why is this a valid regular expression (+ not the first character in > the character class) > > %r{^[-+*/]$} > > but this isn't? (+ is the first character in the character class) > > %r{^[+-*/]$} Its not the '+' that is getting you ... its the '-'. Inside brackets, the '-' means a range (e.g. 'A-Z' for the characters A through Z). But the range "+" (43) through "*" (42) is bad. Inside brackets, the '-' loses its special meaning when it is the first (or last) character. -- -- Jim Weirich jim@weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)