A regex. Specifically /^[[:alpha:][:digit:][:punct:]]+$/

Of course that answers your question, but it's not a good way to validate a URL. URL's are not just made up of arbitrary alphanum and punctuation characters.