Solved

Regex to test if number is over 2048

Posted on 2014-02-10
2
209 Views
Last Modified: 2014-02-10
Hi,
Not sure how to write a regex that tests if number (positive integer) is over 2048 (2049+)? It has to be a regex due to the tool I'm using.

Thanks!
0
Comment
Question by:894359
2 Comments
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 39848589
Here's how to check if it's over 2000:
^([2-9]\d{3}|[1-9]\d{4,})$

HTH,
Dan
0
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 39848600
(2049|20[5-9]\d|2[1-9]\d\d|[3-9]\d\d\d|[1-9]\d\d\d\d)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

816 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now