Re: Ereg problems

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

 



Then I think this will do the trick for you :)

--------------------------------------------------------------------------------

$string = "~YOUR STRING~"

if (!eregi_replace("[0-9A-Za-z -_']","",$string))
    {
         echo "string allowed";
    }
else {
         echo "string disallowed";
}

--------------------------------------------------------------------------------


Warmest Regards,
Dan

----- Original Message ----- From: "Beauford" <phpuser@xxxxxxxxxx>
To: <php-windows@xxxxxxxxxxxxx>
Sent: Tuesday, January 16, 2007 5:59 PM
Subject: RE:  Ereg problems


No, this is what I said in my original email.

I want to allow the following: a to z, A to Z, 0 to 9, and "_-'" (without
the double quotes) and spaces.

I don't care about length, I don't care about order. I just want the user to be able to use these characters. A to z A to Z 0 to 9 and the character _-'
and spaces.

So ABCDE __-' is valid, so is _-aaaBBcD' __

Thanks

-----Original Message-----
From: Niel Archer [mailto:Niel Archer] On Behalf Of Niel Archer
Sent: January 16, 2007 11:46 AM
To: php-windows@xxxxxxxxxxxxx
Subject: Re:  Ereg problems

Hi

  What you've written doesn't match the description you gave.
As a regular expression "([0-9][A-Z][a-z][-_.'\ ])" means a
digit followed by an uppercase letter followed by a lower
case letter followed by (hyphen or underscore or mid-dot or
single quote or space). This is a total of four characters only.
  Is your string only supposed to be four characters in that format?
  I had assumed from your original post, that you wanted a
variable length string, that could only contain alphanumeric
characters plus hyphen, underscore, and single quote (I
missed the space). All of which in any position.  If this is
not the case please describe exactly what it is you're trying
to achieve.



Niel

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



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