Hi,
This is driving me nuts
Basically - I **only** wanna allow a-zA-Z0-9_. and - in the filenames. Failing this, it needs to show an error. The code I came up with is:
It doesn't seem to match quite right though
I'm a perl programmer, so maybe I've just got the regex or something not quite right for Javascript? (I know there are some subtle differences)
TIA
Andy
This is driving me nuts
Basically - I **only** wanna allow a-zA-Z0-9_. and - in the filenames. Failing this, it needs to show an error. The code I came up with is:
Code:
var regtest = /^[a-zA-Z0-9_\.]+$/;
/* var the_test = regtest.test("someÉÊÈËéêèëÏÌÎïìîÖÔÒöô foo bar.jpg");*/
var the_test = regtest.test("somfoo bar.jpg");
alert("the_test is " + the_test);
It doesn't seem to match quite right though
I'm a perl programmer, so maybe I've just got the regex or something not quite right for Javascript? (I know there are some subtle differences)
TIA
Andy