eregi

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

 



Hi,

I'm trying to validate page range data. This can be entered as (example)
i-ix,1,23-45. I am trying to ensure that, where the user is pasting data
from a web page, for instance, that uses an 'n-dash' rather than a hyphen
(but could use something else), that the user is alerted to re-type the
data.

my function is:

function validate_pr($pr){
   $regexp = "([ilmvxcd0-9-]+)";
   $valid = 0;
   if (eregi($regexp, $pr)){
		$valid = 1;
	} else {
		$valid = 0;
	}
   return $valid;
}

but when tested, it just ignores the n-dash and accepts it.

Am I doing something wrong, or is there another test I could use?

MTIA

George

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