regular expression; problem with '-' character

From: Date: Thu, 28 Feb 2002 19:03:35 +0000
Subject: regular expression; problem with '-' character
Groups: php.general 
Request: Send a blank email to php-general+get-86644@lists.php.net to get a copy of this message
Hi, Could someone be kind enough to have a look at this regular expression and perhaps tell me why is returns false when a '-' character is included in the $center string? if (eregi("^[a-zA-Z0-9!@#\$%^&\*\(\),/.//<>\?;':\"~`_\+\|\-\\\t\n\ ]*$", $center)) { return true; } else { return false; } This regular expression is just for making sure that the input contains only characters that are available on a standard (American-English) keyboard i.e. if the string contains a '©' it will return false. Maybe there's a better way to do this without using regular expressions? Thanks very much in advance for any help. - Best regards, Lee

« previous php.general (#86644) next »