I need simple one liner to check for alphanumeric characters with -, _ and . (for filenames), to be used as an if condition.
I tried several things, including ctype_allnum and preg match, but I can't get it to work. For example:
if(!ctype_alnum(preg_replace("-_\.", "", "should_pas-s.html")))
{ sth; }
I know about ctype_alnum, but that takes external (not in one line) array, so it would complicate things. (There are many conditions to check.)