Gavin Kistner wrote: > On Feb 12, 3:49 am, "J. mp" <joaomiguel.pere... / gmail.com> wrote: >> Gavin Kistner wrote: >> > /\A[a-z][a-z.-]{3,28}[a-z]\Z/i > [snip] >> > Note that, per your exact instructions, this allows: >> > u_s_e_r_n_a_m_e >> > u____________________________e >> > z._-_.z >> >> Oh damm!! the first should be allowed but second and the third should >> not be allowed > > OK, but *why* aren't they allowed. You haven't described exactly what > your requirements are. Is it because you can't have to non-letters in > a row? Is it because the string must contain at least three letters? > > BTW, where are these requirements coming from? Are these business > requirements that must be enforced? Are you just making up what you > think people should probably have to use as a name? Or are you just > trying to learn regexp? It's a business requirement. The user name will be used before the domain, for example: I have the domain http://somedomain.com and for each user a unique url will exists like http://user.name.somedomain.com http://david_coperfield.somedomain.com http://andreas-blast.somedomain.com This is my business requirement, so I can only allow user names that can be used in a URI. Thnaks all again, -- Posted via http://www.ruby-forum.com/.