Input Validation Help

I am very new to Javascript. I need to validate some input on an existing PHP/MySQL application.

I have this:

function validateform() {
if (doc.drop.value.length < 1) {
alert(“Please enter a value for the drop.”);
return false;

That makes sure its not empty. But I also need to make sure it only contains a-z A-Z 0-9 and also allow spaces underscores"_" and dashes"-" but thats it. I am sure there is a simple solution to this but I am new to javascript.



if (!/^[\\w -]+$/.test(doc.drop.value)) {