Php regex espression for alphanumeric with dot and slash -
this question has answer here:
- how convert eregi preg_match? 4 answers
i'm trying validate string , want contains alphanumeric chars like: a-za-z
, 0-9
want string can contain dot , slash ('.', '/')
.
i tryed in way, don't right result.
if (!preg_replace('/[^a-za-z0-9./]/', '', (string)$value)){ return false; }
thanks help
just escape required values inside case.
if (!preg_replace('/[^a-za-z0-9\.\/]/', '', (string)$value)){ return false; }
Comments
Post a Comment