Posted By:
neal_ravindran
Posted On:
Friday, November 7, 2003 05:09 AM
To prevent users from entering anything other than alphabets, space or a full-stop, I use this reqular expression as
var re=/[^a-zA-Z_0-9s.]/;
Then use if(re.test(inputStr)) and alert if I find illegal chars. But it seems to bypass all what I want to eliminate(like apostrophes, fwd slashes etc). What is wrong with that regular expression above...iow, why is it not doing what I want(I need only alphabets, underscores, periods and spaces in the string..anything else is illegal in my case) Can you spot?