Solved

Need a regular expression for validation control

Posted on 2014-03-19
2
310 Views
Last Modified: 2014-03-19
I need a regular expression for a regular expression control that only allows numbers (any amount) to the left of decimal (if it needs a decimal) and then only 2 numbers to the right of the decimal.  They may or may not have a number and a decimal place.  But if they use a decimal place they can only input 2 numbers after it .

thanks in advance for the help.
0
Comment
Question by:mgmhicks
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39939675
^(?:\d+(?:\.\d{1,2})?)?$

Open in new window


If they must enter 2 numbers after the decimal--meaning they can't enter just one--then change {1,2} to {2}.
0
 

Author Closing Comment

by:mgmhicks
ID: 39939683
Thank you very much!
0

Featured Post

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.

Question has a verified solution.

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

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

837 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