Hey James, yeah you're right that was a typo, ereg was what I meant. Thanks your suggestion worked and plus I think preg is much faster then ereg so that's cool.
-----Original Message----- From: liljim [mailto:[EMAIL PROTECTED]] Sent: April 22, 2002 4:44 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: ereg size limit??? Hi, "Sp" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am trying to validate my input with ereg but I get the error "Warning: > REG_BADBR" when I try over 255 characters. Is there anyway around this? > > Works > ===== > if(eregi('^[A-Za-z]{1,255}$', "test sentence")) > echo "valid input"; > > Doesn't Work > ============ > if(eregi('^[A-Za-z]{1,256}$', "test sentence")) > echo "valid input"; First off, you're using eregi (case insensitive), but defining a-zA-Z (a through z, case insensitive) in your characters class. You could just use ereg and leave the character class as it is, or drop the A-Z from the eregi version. Secondly, I'd amend your code to: ^[a-z]+$ And thirdly, I'd just use a combination of ereg / preg_* functions and strlen. if(preg_match("/^[a-z]+$/i", $string) && strlen($string) < 255) { echo "Whatever."; } I'm not sure why you're getting that error, but then again, I haven't bothered reading up about it :) James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php