Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: stuck on regexp

by moxliukas (Curate)
on Aug 25, 2002 at 11:02 UTC ( #192659=note: print w/replies, xml ) Need Help??


in reply to stuck on regexp

Well, FreeBSD 'adduser' IIRC displays the regexp that the username must conform to, but I am not at my FreeBSD box now so I can't check that, however here is my stab at a regexp you might need:

/^[A-Za-z][-.A-Za-z0-9_]+$/

This will force the first character to be a-z or A-Z and any other character a-z, A-Z, 0-9, -, . or _. It will also force the login name to be at least 2 characters (I'm not sure if this is what you want) and reject a username made up entirely of numbers (as the first character must be a-z or A-Z)

Hope this helps.

Replies are listed 'Best First'.
Re: Re: stuck on regexp
by jimbobn (Novice) on Aug 25, 2002 at 11:06 UTC
    thanks, that sounds good. i'll give it a go
Re: Re: stuck on regexp
by jimbobn (Novice) on Aug 25, 2002 at 21:06 UTC
    cheers guys.
    how would i apply the maximum/minimum regexp to this expression:  if ($email !~ /.+\@.+\..+/) {   ?

      Use  .{2,10} instead of  .+ (if I did understand your question)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://192659]
help
Chatterbox?
and the monks are mute...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2016-12-09 08:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (148 votes). Check out past polls.