2
Contributors
4
Replies
23
Views
4 Years
Discussion Span
Last Post by AndrisP
0

You can if you use something like this:

var q = "3";
var re = new RegExp("/^(\-)?\d+( (\-)?\d+){" + q + "}$");
if (re.test(str))
    //...
0

I try this:

var q = "3";
var re = new RegExp("/^(\-)?\d+( (\-)?\d+){" + q + "}$");
alert(re.test("1 2 3 4"));

but return false

Edited by AndrisP

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.