Title: Allows dollar sign symbol only.
Name: Jeff
Date: 3/22/2013 11:12:46 AM
Comment:
This is almost perfect but if I type only a '$' sign it'll produce a match. I would expect it to require at least 1 digit.
Title: Very good
Name: Eli Barbosa
Date: 1/21/2010 8:16:03 PM
Comment:
Excellent regex!!!
Title: Very good
Name: Eli Barbosa
Date: 1/21/2010 8:15:41 PM
Comment:
Excellent regex!!!
Title: Modify currency to greek
Name: Nikolas
Date: 6/10/2004 1:52:45 AM
Comment:
How can i modify
"
^\$?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}
[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$
"
to accept values like 23456,56
or 23.456,56 in euros?
Title: Developer
Name: Ray Gudgeon
Date: 6/7/2004 7:15:38 PM
Comment:
When I use this in a .net regular expression validator it requires the commas in amounts > 999
Do you have any idea why?
Title: Modification
Name: Glenn
Date: 5/16/2004 12:19:29 AM
Comment:
Hi, how would you modify this for only allowing 5 digits before the decmial point?
Thanks
Title: Quality
Name: David Anderson
Date: 3/25/2004 11:11:37 AM
Comment:
A quality reg ex - thanks.
And by the way - ignore those idiots who have chosen to be ungrateful - anyone that can't validate for blanks etc. shouldn't be using regular expressions.
Title: Blanks
Name: JER
Date: 3/5/2004 10:33:00 AM
Comment:
I think it's wonderful that it accepts blanks... One should attach a reqval to catch any empty fields before attempting to validate entries anyways.
What happens when fields are optional? If you require a value then you're in trouble... However if you allow blanks to pass then you're ok. If the field is indeed required, just add a reqval on top of it to avoid blank entries.
Wonderful regex! Thanks Tom!
Title: Author
Name: Tom
Date: 1/18/2004 11:57:51 PM
Comment:
Response to Mr. Clancy,
Is your question merely theoretical, about why/how this regex allows null entries to validate?
Are you needing a regex that won't allow null or $ only entries to pass?
Title: Nothingness
Name: Tom Clancy
Date: 1/18/2004 12:45:55 PM
Comment:
<em>I confirm that the field is populated - hence it is fine with me if it matches blanks.</em>
But why should the regex allow an empty string to pass as a valid currency amount when it's not?
Title: Tester
Name: Sanjay
Date: 12/10/2003 2:21:38 PM
Comment:
Thanks. It works fine now. I tweaked it just a little to allow a minus sign without a dollar sign in the data:
^(\$|\-\$|\$\-|-)?([0-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$
Title: Author
Name: Tom
Date: 12/10/2003 12:17:08 PM
Comment:
I did a quick test on this by inserting vertical pipe operator (logical OR) within parenthesis, with along with the optional starting dollar sign. Hence:
^(\$|\-\$|\$\-)?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$
Title: Tester
Name: Sanjay
Date: 12/10/2003 11:07:54 AM
Comment:
How can I change this validation expression to allow an optional minus sign before or after the dollar sign, and irrespective of whether a dollar sign exists in the data ?
Title: Author
Name: Tom
Date: 10/24/2003 12:10:34 AM
Comment:
Depending upon your application/use, these are both valid points.
For me, before I ever authenticate, I confirm that the field is populated - hence it is fine with me if it matches blanks.
As for the $ by itself, the data is stored in a numeric field in a database, so I'm stripping out the $ and , before passing the data through - I just want the flexibility for my users... And since the field is not required, this works.
Title: Tester
Name: Question Guy
Date: 10/23/2003 4:10:30 PM
Comment:
Should "$" (by itself) be a match/valid?
Title: Expression
Name: Danny
Date: 3/23/2003 12:02:43 AM
Comment:
It's a Match for blank entry! How Nice!