I searched a lot and can\'t find the solution for this RegExp (I have to say I\'m not very experienced in Reg. Expressions).
I would like to test a number between 1
^[0-9]|[0-2][0-9]|3[0-6]$
Here's a breakdown of it:
[0-9]
= any digit from 0-9|
= OR[0-2][0-9]
= '1' or '2', followed by any digit from 0-9|
= OR3[0-6]
= '3', followed by any digit from 0-6.As @mu is too short said, using an integer comparison would be a lot easier, and more efficient. Here's an example function:
function IsInRange(number)
{
return number > 0 && number < 37;
}