Hi,
I am using

ereg

for validations of field and I want to allow some fields that are optional but ereg does not allow me to validate space or empty field.My code for validation is

while(list($var,$val)=each($_POST)){
            
		
			if(!ereg($var,$admin_data)){

				if(ereg($reki[$var],$val)) {$class="good";}//this condition is checking the values of all the fields but I want some fields to be allowed

				else {$class="bad";$nbad++;}
					

				 $_SESSION["class"]["$var"]=$class;

				 $_SESSION["basic"]["$var"]=$val;

			}

		}

I have used this pattern but it is not working

$reki["business"]="{ }";
$reki["business"]=" ";

But no success.Can anyone help me.
Thanks in advance

$reki["business"]=" *";

Would mean zero or more spaces, is that what you want ?

Sidenote: ereg has been deprecated, I suggest you switch to the preg_XXX functions instead.

Thanks a lot I have solved the problem and thanks for the information that ereg is deprecated