background :
The actual project will use the interval price, so there is the "lowest price-high price" or "price" of the two formats, determine the character input format the first must think of a regular expression, but not used for a long time, and common on the Internet: such as mailbox, mobile phone number, URL, IP, etc., but this I did not search, So I only wrote it myself.
references :Regular expression table: Http://www.jb51.net/shouce/jquery1.82/regexp.html Test Regular expression: http://regex.supfree.net/
Dry Area:^\d{1}$|^\d+ (\.\d+)? [-]? (\d+\.)? \d+$|(^\d\.\d$)Or explain the mistakes can be modified using: A, ^\d{1}$|: This judge only a number of cases 0-9b, (^\d\.\d$): Judge 9.1 Three length of the case C, ^\d+ (\.\d+)? [-]? (\d+\.)? \d+$|: Judging all the other cases AB is a case of adding a bad judgment in C
remaining questions:There is the middle line (-) must be greater than the previous situation has not been considered, the above may be too complex, I hope the great God to help add a better way, thank you!
Regular judgment the horizontal line (-) either side of the input is a positive integer and a positive floating point number, or just enter a full or floating point number