Title |
Test
Find
Pattern Title
|
Expression |
^0$|^[1-9][0-9]*$|^[1-9][0-9]{0,2}(,[0-9]{3})$ |
Description |
I need a pattern to match the whole number / integer (0-99999...), but also allow users to put comma in the thousand positions.
This is what I got. |
Matches |
1234 | 0 | 12,345 |
Non-Matches |
12,3245 | -1 | 1234.23 |
Author |
Rating:
Harry Chou
|
Source |
|
Your Rating |
|
Title: You are right
Name: Harry Chou
Date: 4/5/2005 4:53:30 PM
Comment:
You are right. That's my typo. The expression should be:
^0$|^[1-9][0-9]*$|^[1-9][0-9]{0,2}(,[0-9]{3})*$
Title: Arbitrary length with commas
Name: Gideon Engelberth
Date: 4/5/2005 11:13:29 AM
Comment:
Right now the expression matchs number of arbitrary length as long as they dont have a comma, but only matches one comma group. This could be fixed by changing the end of the pattern to be (,[0-9]{3})*$