Solved

Regex for Integer Equal to or greater than 100

Posted on 2013-12-06
8
1,860 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

856 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