Javascript simple regexp doesn't work
Posted
by bah
on Stack Overflow
See other posts from Stack Overflow
or by bah
Published on 2010-05-16T23:26:53Z
Indexed on
2010/05/16
23:30 UTC
Read the original article
Hit count: 185
JavaScript
|regex
Hi, I have this code, it looks alright and is really basic, but i can't make it work:
function checkValid(elem){
var abc = elem.value;
var re = "/[0-9]/";
var match = re.test(abc);
alert(match);
}
It matches 0 and 9, but not 1 to 8, what's wrong here? Thanks.
© Stack Overflow or respective owner