What about
^-?\d*((,\d)*)?(\.\d{1,2})?$
matches 12345 12345.6 12345.67 12,345.6
When you dont want to match 12345 (comma is missing), use
^-?\d{1,3}((,\d)*)(\.\d{1,2})?$
Btw I used http://regexlib.com
/RETester.aspx to do some tests ;)
HTH
// Ryan
On 7/19/06, Stacey Levine <staceyl musicforasong.com>
wrote:
> I have the regular expression below that does numbers
with 2 decimals.
> I need it to also accept commas in the correct places
(based on US
> standards). Any help on that?
>
>
>
> ^-{0,1}\d*\.{0,1}\d{0,2}$
>
>
>
> Stacey Levine
>
> Lead Technical Architect
>
> Value Music Concepts
>
> 825-C Franklin Court
>
> Marietta, GA 30067
>
> 678-229-4255
>
>
>
>
> ===================================
> This list is hosted by DevelopMentor(r) http://www.develop.com
>
> View archives and manage your subscription(s) at http://discuss.develop.com
>
===================================
This list is hosted by DevelopMentorŪ http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|