Possible Duplicate:
how to match a number which is less than or equal to 100?
我需要这两个值之间的正则表达式1000
/(1[8-9]|[8-9]|[8-9]|5[0-9]|[0-9]|[0-9]|[0-9]|[0-9])/
有任何想法吗?提前致谢!
最佳答案
您是否有特定原因不只是将数字作为数字进行测试?
var yourNum = parseInt(yourString, 10); // use parseFloat if it has decimals
if (yourNum >= 1000 && yourNum <= 500000) {
// success
} else
// fail
}