$ perl -le 'print "hello world" =~ /^[[:alnum:]]+$/ ? "OK" : "BAD"' BAD ---> space is not alnum $ perl -le 'print "hello_world" =~ /^[[:alnum:]]+$/ ? "OK" : "BAD"' BAD ---> _ is not alnum $ perl -le 'print "HelloWorld1" =~ /^[[:alnum:]]+$/ ? "OK" : "BAD"' OK --> nothing there but letters and digits