Regular expression bigger and smaller

This expression should check for a number> 1

^ [1-9] + [0-9] * $

  • what is an expression to check, it is greater than a given value, say, "99"?
  • what about values ​​less than 99?

Update:

I am using ASP.NET validation validation.

Thanks.

+4
source share
2 answers

You say that this is homework, so I will give my answer more than 57; You can accept this idea and change it.

/^([6-9][0-9]|5[89]|[1-9][0-9]{2,})$/ 

If you do not have the {a,} construct,

 /^([6-9][0-9]|5[89]|[1-9][0-9][0-9]+)$/ 
+6
source

I agree with the comment by @Rowlf! You do not need a regular expression for this (unless it is an interview question :)). Just use the '>'.

Well, your given regular expression ^[1-9]+[0-9]*$ matches >=1 not only >1

+1
source

All Articles