It works, your expression is wrong. Try '/^[a-zA-Z]{1,}[a-zA-Z0-9]$/'. On Mon, Jul 26, 2010 at 15:34, mlu...@gmail.com <mlu...@gmail.com> wrote: > Hi! > > In my app i am using sfGuardPlugin. I have extended the class > sfGuardUserForm to build my own registration form class. In the > overridden configure method I have code below to define the rules for > the username: > > $this->setValidator('username', > new sfValidatorAnd( > array( > new sfValidatorString( > array( > 'required' => true, > 'max_length' => 64, > 'min_length' => 4 > ), > array( > 'invalid' => "The username isn't available.", > 'required' => 'Please enter a username.', > 'max_length' => 'The username can not be longer than > %max_length% characters.', > 'min_length' => 'The username can not be shorter than > %max_length% characters.' > ) > ), > new sfBlacklistValidator( > array('listed_error' => "The username '%value%' isn't > available." ) > ), > new sfValidatorRegex( > array( > 'pattern' => '/[a-zA-Z]{1,}[a-zA-Z0-9]/' > ), > array( > 'invalid' => "Your username isn't valid. Please start with a > character and use characters from a to z and numbers only." > ) > ) > ) > ) > ); > > I want the username to begin with an character followed by any number > of characters ot numbers, but the RegexValidator doesn't seen to work, > because I can register the username "0aaaa" which is starting with a > zero. > > Any ideas what I am doing wrong? > > regards, > > michael > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en >
-- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en