Tuesday, 27 August 2013

Regex for validating numbers preceding with two dashes (hyphens)

Regex for validating numbers preceding with two dashes (hyphens)

I got stuck with regexp to validate only numbers from 1-10 that could have
two dashes(hyphens) before, for example:
--9
or
--10
or
--1
but not
--11 or not --0
I tried like seems to me everything, example:
/(-\-\[1-10])/
What is wrong?

No comments:

Post a Comment