From: Roger Pack Date: 2011-02-17T08:22:52+09:00 Subject: Re: regex simplifier? > %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}*" -- Posted via http://www.ruby-forum.com/.