For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > July 2004 > REG_BADRPT error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author REG_BADRPT error
Aaron Todd

2004-07-19, 3:57 pm

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
Aaron Todd

2004-07-19, 3:57 pm

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

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com