On Thu, Feb 17, 2011 at 12:22 AM, Roger Pack <rogerpack2005 / gmail.com> wrote:
>> %r{(?<re>#{float})#{whitespace}(?<op>[+-])#{whitespace}(?<im>#{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/