if(!preg_match("~[0-9A-Za-z-/]+~", $url_key)) {}
The ~ marks the begin and end of the regex (any 2 matching chars). You do not need a comma to separate the items. The + says it has to be one or more of the preceding characters.
pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
Because you used a slash as begin/end terminator, it means you will have to escape it, if you need to use it in the pattern (with a backslash).
pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
Use the start and end markers ^ and $
pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875