Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

letters, numbers and spaces only

  •  01-26-2007, 4:00 PM

    letters, numbers and spaces only

    Good Day.

    I am using the following code to validate data on a HTML page

    function checkTermMoYr (strng) {
     var error = "";
     if (strng == "") {
        error = "You didn't enter a Loan Term.\n";
     }
    //var illegalChars = /\W/;
    var illegalChars = \s;
      // allow only letters, numbers, and underscores
        if (illegalChars.test(strng)) {
           error = "The Loan Term contains illegal characters.\n";
        }
       return error
       }

    What I can't figure out is how to allow only letters, numbers and spaces. Any help is greatly appreciated.

     

View Complete Thread