Solved

Regex for Integer Equal to or greater than 100

Posted on 2013-12-06
8
1,798 Views
Last Modified: 2013-12-06
Need a regex for integers equal to or greater than 100.
0
Comment
Question by:894359
  • 3
  • 3
  • 2
8 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39702545
You can use:

^(1\d\d|\d{4,})$

Open in new window

0
 

Author Comment

by:894359
ID: 39702557
Hi,
This doesn't work . try 999 or any number that doesn't start with a 1 and is 3 digits long.
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39702563
My apologies. I was writing that on the way out of the door of the office. Corrected:

^([1-9]\d\d|[1-9]\d{3,})$

Open in new window

0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39702566
Shorter version:

^[1-9]\d\d\d*$

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 39702585
Why a regex?

if( i * 1 >= 100 ) { // in term of performance it's faster than a regex !
   alert("your integer is equal to or greater than 100!")
}
0
 

Author Comment

by:894359
ID: 39702606
I have to use a regex. it is for a tool.
0
 

Author Closing Comment

by:894359
ID: 39702608
Thank you!
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39702624
So why Javascript topic? Anyway, if you're happy, I'm happy... and I think kaufmed is happy too :)

Have a nice week-end!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question