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

apache - setting document root in antoher partition on ubuntu -

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

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -