RE: Ereg problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nope, doesn't work for me. I think what I'm trying to do must not be
possible. I've been at this for two days now. I changed yours to this - ereg
("([0-9][A-Z][a-z][-_.'\ ])"  but it always says that it is invalid. The
last one after the slash is supposed to be a space - I have to have a space.
I don't need a length.

> -----Original Message-----
> From: bedul [mailto:landavia81@xxxxxxxxx] 
> Sent: January 15, 2007 11:48 PM
> To: Beauford
> Subject: Re:  Ereg problems
> 
> <?
> $nlong=strlen($username);
> if(ereg ("([0-9][A-Z][a-z][_-]{$nlong})", $username){
>     echo "allowed";
> }else{
>     echo "disallowed";
> 
> }
> 
> //taken from ereg help
> /*
> if (ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $date, $regs)) {
>     echo "$regs[3].$regs[2].$regs[1]";
> } else {
>     echo "Invalid date format: $date";
> }
> */
> ?>
> 
> ----- Original Message -----
> From: "Beauford" <phpuser@xxxxxxxxxx>
> To: <php-windows@xxxxxxxxxxxxx>
> Sent: Tuesday, January 16, 2007 10:59 AM
> Subject:  Ereg problems
> 
> 
> > Hi,
> >
> > Without getting into a long drawn out discussion, can 
> anyone show me a 
> > way to validate a string that is input from a form.
> >
> > I want to allow the following: a to z, A to Z, 0 to 9, and "_-'" 
> > (without the double quotes) and spaces. I have now been screwing 
> > around with this
> for
> > over 8 hours. There are other issues as well that has been 
> compoudning
> this,
> > but this would be a great start to solving my issue.
> >
> > Thanks
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/) To 
> unsubscribe, visit: 
> > http://www.php.net/unsub.php
> >
> 
> 
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux