From: Phrogz Date: 2007-11-27T09:15:01+09:00 Subject: Re: About a regular expression On Nov 26, 4:34 pm, T5in9tao Tsingtao wrote: > Thank you. But I belive that don't work yet, even if I update the code > like this: > > -------------------------------- > > domain_name = /[a-zA-Z0-9-]{1,63}\.(aero|biz|com|org)/ > > string = '

href="http://haiku-os.org">Haïku

' > result = string.scan(domain_name) > result.each { |x| puts x } domain_name = /[a-zA-Z0-9-]{1,63}\.(?:aero|biz|com|org)/ If a regular expression has capture groups in it, String#scan returns those groups, not the entire matched expression. Placing the ?: inside the parentheses instructs Ruby not to treat the contents as a capture group.