eregi

From: Date: Mon, 13 Sep 2004 10:35:59 +0000
Subject: eregi
Groups: php.windows 
Request: Send a blank email to php-windows+get-24560@lists.php.net to get a copy of this message
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

« previous php.windows (#24560) next »