On Nov 26, 4:34 pm, T5in9tao Tsingtao <t5in9... / gmail.com> 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 = '<p><strong><a
> href="http://haiku-os.org">Hař╠u</a></strong></p>'
> 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.