From: Daniel Berger Date: 2003-04-17T07:41:10+09:00 Subject: Re: regular expressions "Hal E. Fulton" wrote: > > But there is a complexity threshold where I would > rather have a more verbose, readable, multi-line > notation. FWIW, there's always the /x option: phoneregex = / ^ # Beginning of string \d{3,} # starts with three digits \-* # ...followed by an optional dash \d{3,} # ...followed by three more digits \-* # ...followed by an optional dash \d{4,} # ...follwed by four digits $ # end of string /x phone1 = "303-555-1212" phone2 = "3035551212" phone3 = "abc123xyz" if phoneregex.match(phone1) puts "Yes! #{phone1}" else puts "No! #{phone1}" end if phoneregex.match(phone2) puts "Yes! #{phone2}" else puts "No! #{phone2}" end if phoneregex.match(phone3) puts "Yes! #{phone3}" else puts "No! #{phone3}" end I realize that it's not really what you're talking about, but sometimes I use this approach to help myself out mentally when tackling a complex regex. If nothing else, it's here in case there are folks who don't know about extended mode. Regards, Dan -- a = [74, 117, 115, 116, 32, 65, 110, 111, 116, 104, 101, 114, 32, 82] a.push(117,98, 121, 32, 72, 97, 99, 107, 101, 114) puts a.pack("C*")