Re: Re: REG_BADRPT error
| From: | Aaron Todd | Date: | Mon, 19 Jul 2004 16:40:56 +0000 |
| Subject: | Re: Re: REG_BADRPT error | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35372@lists.php.net to get a copy of this message | ||
Thanks for the help. Being new to PHP I was unaware that I could use some
perl compatible regexes here. That will help me out a lot.
Thanks again,
Aaron
"Justin Patrin" <papercrane@gmail.com> wrote in message
news:432beae0407190901e8426ef@mail.gmail.com...
> In this case, it seems like you're looking for a lot of different and
> exclusive things at once. I would suggest not using a huge regex as
> they can be hard to create, harder to read, and impossible to
> maintain. That said, I do use regexes in some of my code, just not for
> something this simple. ;-) I generally use Perl Compatible Regexes as
> I understand them better. Try:
>
> if(strlen($pass) < 6 || !preg_match('/[a-z]/i', $pass) ||
> !preg_match('/[0-9]/', $pass)) {
> //bad password
> }
>
> On Mon, 19 Jul 2004 11:10:47 -0400, Aaron Todd <aaloki88@hotmail.com>
wrote:
> > Hello,
> >
> > Ive been trying a few things and finally I did get rid of the error. I
> > changed the code to:
> > if (!ereg('^(!?=.*[0-9]+.*)(!?=.*[a-zA-Z]+.*)[0-9a-zA-Z]{6,}$',
$pass)){
> > Notice the ! before the two ?
> >
> > This got rid of the error, but it still isnt working the way I want it
to.
> > That line should validate the variable $pass, which should be greater
than 6
> > characters and contain at least one numbers and one letter. That line
> > should be true if $pass does not equil 6 characters and contain at least
one
> > numbers and one letter.
> >
> > Can someone correct me on this. I am new to PHP so I am still trying to
get
> > the hang of it.
> >
> > Any help will be appreciated.
> >
> > Thanks,
> >
> > Aaron
> >
> > "Aaron Todd" <aaloki88@hotmail.com> wrote in message
> > news:20040719135401.23199.qmail@pb1.pair.com...
> >
> >
> > > Hello,
> > >
> > > I am getting an REG_BADRPT error when I use ereg.
> > >
> > > The line of code that errors is:
> > > if (!ereg('^(?=.*[0-9]+.*)(?=.*[a-zA-Z]+.*)[0-9a-zA-Z]{8,}$',
$pass)){
> > >
> > > I got this regex from regexlib.com and tried to impliment it, but no
> > matter
> > > what I do it always returns the error. I did a google search and the
only
> > > suggestion I found was to make sure that the variable contains data.
So I
> > > echoed the variable and it did have data in it. Does anyone know why
I
> > > might be getting this?
> > >
> > > Thanks,
> > >
> > > Aaron
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > !DSPAM:40fbe26957361384218867!
> >
> >
>
>
> --
> DB_DataObject_FormBuilder - The database at your fingertips
> http://pear.php.net/package/DB_DataObject_FormBuilder
>
> paperCrane --Justin Patrin--