From: Nat Pryce Date: 2001-08-07T04:06:29+09:00 Subject: [ruby-talk:19245] Re: Regexp#to_s not very useful > I think it'd be nice if what Regexp#to_s and Regexp#inspect returns > were swapped. I'd like to be able to puts a Regexp and receive > something meaningful, just like other Ruby objects which have a > meaningful to_s. > > Anyone agree or disagree? Agree! In fact, swapping the two methods would make it much easier to define regexps and then embed them in other regexps, which would make defining complex regular expressions much more readable: DIGIT = /[0..9]/ IDENTCHAR=/[a-zA-Z_]/ IDENTIFIER=/#{IDENTCHAR}(#{DIGIT}|#{IDENTCHAR}*)/