Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Validating an Amount Field  RSS feed

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • 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.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!