jimbobn has asked for the wisdom of the Perl Monks concerning the following question:
Hi All
I have a field that needs to be checked for validity.
It can only contain a-z A-Z 0-9 . _ -
But . _ - characters cannot be at the begining of the field, and the field can not be just 0-9 or contain 0-9 as the first character i.e:
OK:
billy.bob
billy_bob
billy-bob
billybob
BILLYBOB
BillyBob
Billy2Bob
BillyBob2
NOT OK:
______
_billybob
1billybob
1111
billy^bob
Basicaly, i need to check a name is vaild before passing it over to the unix command 'useradd'.
I have had a go at it myself and looked at some of the tutorials, but no suck luck :-( Thanks
I have a field that needs to be checked for validity.
It can only contain a-z A-Z 0-9 . _ -
But . _ - characters cannot be at the begining of the field, and the field can not be just 0-9 or contain 0-9 as the first character i.e:
OK:
billy.bob
billy_bob
billy-bob
billybob
BILLYBOB
BillyBob
Billy2Bob
BillyBob2
NOT OK:
______
_billybob
1billybob
1111
billy^bob
Basicaly, i need to check a name is vaild before passing it over to the unix command 'useradd'.
I have had a go at it myself and looked at some of the tutorials, but no suck luck :-( Thanks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: stuck on regexp
by moxliukas (Curate) on Aug 25, 2002 at 11:02 UTC | |
by jimbobn (Novice) on Aug 25, 2002 at 11:06 UTC | |
by jimbobn (Novice) on Aug 25, 2002 at 21:06 UTC | |
by fglock (Vicar) on Aug 25, 2002 at 23:43 UTC | |
Re: stuck on regexp
by hotshot (Prior) on Aug 25, 2002 at 11:13 UTC | |
by jimbobn (Novice) on Aug 25, 2002 at 12:15 UTC | |
by moxliukas (Curate) on Aug 25, 2002 at 13:00 UTC | |
by particle (Vicar) on Aug 25, 2002 at 14:57 UTC | |
by Anonymous Monk on Aug 25, 2002 at 15:23 UTC | |
by hotshot (Prior) on Aug 25, 2002 at 12:32 UTC | |
Re: stuck on regexp
by erikharrison (Deacon) on Aug 25, 2002 at 15:42 UTC |
Back to
Seekers of Perl Wisdom