Jump to content

eregi() REG_BADBR error???


hadoob024

Recommended Posts

I can't figure out what this is for the life of me.  Here's the error I'm getting:

 

Error Message: eregi() [<a href='function.eregi'>function.eregi</a>]: REG_BADBR

Error Code: 2

 

 

 

This error corresponds to the following area of code:

 

if (!eregi('^[a-zA-Z[:blank:].`\'\-]{1,30}$', $city))

{

$problem = 5;

$problemtext .= "<B>City (or Country if international) name can only be composed of the letters A through Z, and the following symbols:  -, ', and `.</B><P>";

}

 

if (!eregi('^[[:blank:][:punct:][:alnum:][:space:]]{1,500}$', $listingdescription))

{

$problem = 5;

$problemtext .= "<B>Listing description can only contain letters, numbers, punctuation, tabs, and spaces.</B><P>";

}

 

 

 

Any thoughts?

Link to comment
https://forums.phpfreaks.com/topic/42813-eregi-reg_badbr-error/
Share on other sites

Try this:

 

if (!preg_match('|^[[:blank:][:punct:][:alnum:][:space:]]{1,500}$|', $listingdescription))

 

preg is faster than ereg too.. it's a win-win situation :)

 

Edit: There's no need to use eregi() rather than ereg() when you are not mentioning characters by name (or when you include both a-z and A-Z as in the first regex).  eregi('A-Z') and eregi('a-z') are identical, because eregi() ignores case.

Link to comment
https://forums.phpfreaks.com/topic/42813-eregi-reg_badbr-error/#findComment-207830
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.