From: eben smith Date: 2011-02-17T18:59:33+09:00 Subject: Re: regex simplifier? --bcaec53f943d2db354049c777470 Content-Type: text/plain; charset=ISO-8859-1 Hey gang, This is my first response. I don't know if this helps, but I use this site quite a bit to clarify regular expressions when I am working with them. http://www.rubular.com/ Regards, Eben Smith On Thu, Feb 17, 2011 at 2:53 AM, Robert Klemme wrote: > On Thu, Feb 17, 2011 at 12:22 AM, Roger Pack > wrote: > >> %r{(?#{float})#{whitespace}(?[+-])#{whitespace}(?#{float})i} > >> > >> But the kicker is still how to remember that \s is white space, not \w. > >> And we've been forced to do some tip toeing around the complexities of > >> regex in order to make it readable. > >> > >> I had thought of a regex creator helper > >> > >> float = reg { optional(/[-+]/) + 'DIGIT+ \. DIGIT+' } > > > > I just found something related, for followers: > > > > posix characters are apparently embedded in there: > > > > [:blank:] > > > > like > >>> ' a '.scan /[[:blank:]]/ > > => [" ", " "] > >>> ' a '.scan /[^[:blank:]]/ > > => [" ", " "] > > > > ref: http://psoug.org/reference/regexp.html > > > > Though I still wouldn't be averse to something like > > Regexp::DIGIT => '\d' > > > > So one can do "#{Regexp::DIGIT}*" > > Did I mention that what Ari and I cooked up a while ago is a gem? > > http://rubygems.org/gems/TextualRegexp > > Cheers > > robert > > -- > remember.guy do |as, often| as.you_can - without end > http://blog.rubybestpractices.com/ > > --bcaec53f943d2db354049c777470--