• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Validating an Amount Field

 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to make sure a text field is any non-negative numeric value with 2 or less decimal point not less then say $100000. What is the simplest combination of the standard rules/regular expressions to achieve this with the validator?

Also, if I want to allow the user to optionally add commas like 10,000. What would the simplest combination of rules.

I guess the 'mask' rule has to be used with some regular expression. But my knowledge of regexpr is very little!

Thx for any advice.
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here are some expressions that I put together a while ago. I tested them at the time and they have been in use for a few years so I hope they work. Like you, I don't know much about regular expressions, but I was smart enough to add a comment.


- Brent
 
reply
    Bookmark Topic Watch Topic
  • New Topic