Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The regex should also check for commas. ($1,000, $10,000, $100,000).
I searched for a cpan module, but couldn't find anything.
This is what I have come up with so far:
Could you improve it?/^\$?(?:\d{1,3},\d\d\d|\d{4,6})\.?\d?\d?$/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: matching USD amounts
by Marshall (Canon) on Aug 31, 2009 at 05:57 UTC | |
|
Re: matching USD amounts
by eye (Chaplain) on Aug 31, 2009 at 04:46 UTC | |
|
Re: matching USD amounts
by Anonymous Monk on Aug 31, 2009 at 04:35 UTC | |
|
Re: matching USD amounts
by Narveson (Chaplain) on Aug 31, 2009 at 16:48 UTC | |
|
Re: matching USD amounts
by Anonymous Monk on Aug 31, 2009 at 04:11 UTC | |
|
Re: matching USD amounts
by ashish.kvarma (Monk) on Aug 31, 2009 at 13:50 UTC |