Php regex espression for alphanumeric with dot and slash -


this question has answer here:

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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -