I need to validate some data and confirm that the pattern contains only a-z
, A-Z
, 0-9
, full-stop
or a forward slash
.
if(!preg_match("/^[a-zA-Z0-9 ./]*$/",$field)) {
$fielderror = "Field can only contain a-z A-Z 0-9 . /";
}
However, it seems to allow other special characters e.g.: @ # and $
.
any thoughts? Thinking i am missing something really obvious....