Gavin Kistner wrote: > On Feb 12, 8:25 am, "J. mp" <joaomiguel.pere... / gmail.com> wrote: >> Gavin Kistner wrote: >> > OK, but *why* aren't they allowed. You haven't described exactly what > So, my reading of that (and I'm not an expert) is that a machine name > MAY have digits in it (including at the start or end), may NOT have > underscores, and may be pretty darn long. (Though it makes sense to > put some sort of bound on it - if you think 30 chars is OK, so be it.) > > A regexp for this, allowing multiple dotted names joined together: > > # Regexp for a single name > /[a-z\d](?:[a-z\d-]*[a-z\d])?/i > > # Regexp for 1 or more of those joined by periods > /(?:[a-z\d](?:[a-z\d-]*[a-z\d])?)(?:\.[a-z\d](?:[a-z\d-]*[a-z\d])?)*/i > > > [1] http://www.gbiv.com/protocols/uri/rfc/rfc3986.html > [2] http://rfc-ref.org/RFC-TEXTS/1123/chapter2.html#sub1 > [3] http://rfc.net/rfc952.html#sA. So, Gavin your last regex allows only valid host names on an URI? I'm sorry for not reading the RFC before. My requirement is what I said, the user name will act as part of an URI, so I should allow any combination of chars that are valid for the first part of an URI -- Posted via http://www.ruby-forum.com/.