Re: ereg is failing on this simple test

From: Date: Sat, 13 Dec 2003 04:01:25 +0000
Subject: Re: ereg is failing on this simple test
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-172628@lists.php.net to get a copy of this message
it works if you remove the last $ from the expression, also I think the . needs escaping unless you have a special reason, use preeg_* as it is supposed to be quicker Mike Manuel Ochoa wrote:
Why is this test failing? $data = "A Simple test."; If (ereg("^[a-zA-Z0-9\s.\-_']+$", $data)) { echo "Valid text"; } else { echo "Not valid text"; } I'm running PHP 4.34 on a windows pc. This function is new to me, any help would be appreciated.


« previous php.general (#172628) next »