Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

money validation

0 views
Skip to first unread message

sjef

unread,
Mar 4, 2009, 7:51:01 AM3/4/09
to
Hallo,
I.ve created a regular expression for validating maney (in Dutch
format).

^([0-9]+)|(\.[0-9]+)(,[0-9]{1,2})$

it should accept numbers such as:

xx.xxx.xxx,xx
xx,x
xxxxxx,xx

but it also accepts

xxxxx.xx,xx

and that's wrong!! and it also accepts more then 2 decimals (like
xxxxx,xxxx) And that's wrong too.

I.m getting totally confused by this. Any ideas?

Gabriel Vieira

unread,
Mar 24, 2009, 7:18:40 AM3/24/09
to

perl -E "say /^\d{1,3}(\.\d{1,3})*(,\d{1,2})$/?'Ok':'Error' for qw
(123,12 123.123.123,12 12,1 1,1 1234,12);"

Try this one :)

Cya!

0 new messages