P
Pit Capitain
2007/8/8 said:Did you think about something like this (attached)? This is just a
raw hack to illustrate a possible way to do it.
Quote:
mail_addr = TextualRegexp.new do
anchor :beginning
group :capturing do
at_least_once { any "a-z" }
end
literal "@"
repeat 1..4 do
at_least_once { any "a-z" }
literal "."
end
any %w{com edu org}
end
I like this! A readable DSL for regular expressions.
Regards,
Pit