Posts: 850
Name: Matt Pealing
Location: England, north west
|
Thanks
Quote:
Originally Posted by JeremyMiller
Not sure what the purpose of your second [] section is, but try
or
Again, that's depending on what the second part is for.
|
I think the second part was to match a space character, but it was quite a while ago so I can't really remember why I did it like that!
For some reason this bit of code evaluates to true
Code:
var regex = new RegExp ('[a-zA-Z]');
alert (regex.test ('f4'));
I thought that a regex such as that would only allow uppercase and lowercase letters; nothing else. But the string 'f4' results in a match! Im not too sure what I'm doing from though? I presume I need a '\s' in there somewhere to match a space character aswell.
|