Posted by Kimmo Laine on 04/28/06 14:19
<millw0rm@gmail.com> wrote in message
news:1146208077.913936.287620@j73g2000cwa.googlegroups.com...
> why i m getting error here???
>
> Warning: ereg(): REG_BADBR
>
>
> code:
> if(!ereg("^(.){15,400}$",$string)) {
> $errormsg[1] = "- Must be more then 15 Characters & less then 400
> Characters";
> }
>
>
> Want to Achive:
> $string is a textarea, i want the user to input atleast 15 characters
> and shldnt exceed more then 400 characters!
Don't know, but why would you need to use a regexp for so trivial case?
Remember the KISS rule: Keep it simple, stupid.
if( ($len = strlen($string)) < 15 || $len > 400) {
$errormsg[1] = "- Must be more then 15 Characters & less then 400
Characters";
}
--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
[Back to original message]
|