From: Timothy Hunter Date: 2007-02-12T08:56:12+09:00 Subject: Re: Regular expressions J. mp wrote: > Vincent Fourmond wrote: > >> J. mp wrote: >> >>> Hi folks, >>> I'm burning my head because i don't understand how regular expressions >>> works >>> >>> I just want to validade a username wher >>> username ->valid >>> user.name ->valid >>> >>> everything else is invalid >>> >> Just to get you started: >> >> /[a-z]+(\.[a-z]+)?/ >> >> Vince >> > > > First of all, thanks for the attention. > More details: > > max size allowed is 30 > min size allowed is 5 > > the follwoing chars are allowed : > - _ . (Slash, undescore, perdiod) > > these chars are not allowed as start neither as ending char > > any alphabetic char, english chars only > case insensitive > no numbers > > eg > .username ->invalid > user-name -> valid > _username -> invalid > user.name -> valid > user_name ->valid > > /\A[[:alpha:]][-_.[:alpha:]]{3,28}[[:alpha:]]\z/ > basically I want allow the same pattern allowed for emails but before > the @ char :) > > The above regexp does not do this. Certainly you can have numbers in your email address, for example. Basically anything is allowed before the @. Google "regular expression email address" for extensive discussions about this.