Avatar of MJ
MJ
Flag for United States of America asked on

Regex for Integer Equal to or greater than 100

Need a regex for integers equal to or greater than 100.
JavaScript

Avatar of undefined
Last Comment
leakim971

8/22/2022 - Mon
kaufmed

You can use:

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

Open in new window

MJ

ASKER
Hi,
This doesn't work . try 999 or any number that doesn't start with a 1 and is 3 digits long.
kaufmed

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

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
kaufmed

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
leakim971

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!")
}
MJ

ASKER
I have to use a regex. it is for a tool.
MJ

ASKER
Thank you!
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
leakim971

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

Have a nice week-end!