From: dblack@... Date: 2007-08-07T17:52:56+09:00 Subject: Re: Alternate Regular Expressions? Hi -- On Tue, 7 Aug 2007, Ari Brown wrote: > I'm moderately serious. This is going to be one of those projects that won't > see the light of day for maybe 6 months to a year. > This looks largely what I was hoping to make, although in Ruby I had > invisioned this: > > matching email addresses (sample): > a = LeetExp.new(:letters => [[a-z], :insensitive], > :string => "@", > :letters => [[a-z], :insensitive], > :string => ".", > :string => ["com", "net", "org", "edu"] > ) > > case line > when a > # ... > > My idea is to make it logical and human readable. Ruby is a language for > humans and UberBeings, and I think this should reflect Ruby's ideas. Regular expressions are nothing if not logical :-) And readability, as always, is largely in the eye of the beholder. I think the quest for an alternative notation is fine, but there's nothing inherently un-Ruby-like about what's there already. Then again, I'm in a small minority who find /x with a lot of extra whitespace a serious impediment to understanding a pattern :-) Anyway -- somewhere out there, though I haven't been able to find it, is a library called Regexp::English by Florian Gross, which provides a kind of English-language wrapper for regexes. I don't know whether it's still in development and/or at a point of usability. David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)