You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by david chan <da...@yahoo.com> on 2003/08/14 16:09:01 UTC

validation mask for currency

Hi,
 I need a regular expression for checking the dollar
among inputed by user (using validator struts 1.1
mask)
 Here are some valid money (comma and period are
allowed in specify location):

 432,343.12
 212.12
 0.00
 1294

 The max. value should be less than 9999999

 Any regular expression expert can help?

Thanks.
David

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: validation mask for currency

Posted by Yansheng Lin <ya...@isogis.com>.
Correct.  I am familiar with Both North America and Asia Conventions, and I've
never seen anyone uses comma abundantly as david suggested.  However, for study
purpose, the following should work:
	
	<var-value>^\d{1,3}(,?\d{1,3})*\.?(\d{1,2})?$</var-value>

-----Original Message-----
From: Steve Raeburn [mailto:sraeburn@apache.org] 
Sent: August 14, 2003 11:01 AM
To: Struts Users Mailing List
Subject: RE: validation mask for currency


Unless there's some regional standard that I'm unfamiliar with, currencies
(in fact, any numbers) are *always* grouped in threes. Otherwise the commas
are meaningless.

Steve

> -----Original Message-----
> From: david chan [mailto:david_tomcat@yahoo.com]
> Sent: August 14, 2003 9:12 AM
> To: Struts Users Mailing List
> Subject: RE: validation mask for currency
>
>
> Thanks. But the comma can be in anywhere in between
> first digit and the period.
>
> so this is valid also:
> 1,23,22
> 1234,2.3
>
> how to do that? (I am really new to regular
> expression)
>
> Thanks.
> David
>
> --- Yansheng Lin <ya...@isogis.com> wrote:
> > Try:
> > 	<field
> > 		property="xxxx" depends="mask"
> > 		<msg="mask"	key="xxx.displayname"/>
> > 		<var>
> > 			<var-name> mask</var-name>
> >
> >
> <var-value>^\d{1,3}(,?\d{3})*\.?(\d{1,2})?$</var-value>
> > 		</var>
> > 	</field>
> >
> > I tested your numbers, it seemed to work; but more
> > testing needed:).
> >
> >
> >
> > -----Original Message-----
> > From: david chan [mailto:david_tomcat@yahoo.com]
> > Sent: August 14, 2003 8:09 AM
> > To: Struts Users Mailing List
> > Subject: validation mask for currency
> >
> >
> > Hi,
> >  I need a regular expression for checking the dollar
> > among inputed by user (using validator struts 1.1
> > mask)
> >  Here are some valid money (comma and period are
> > allowed in specify location):
> >
> >  432,343.12
> >  212.12
> >  0.00
> >  1294
> >
> >  The max. value should be less than 9999999
> >
> >  Any regular expression expert can help?
> >
> > Thanks.
> > David
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site
> > design software
> > http://sitebuilder.yahoo.com
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> >
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: validation mask for currency

Posted by Steve Raeburn <sr...@apache.org>.
Unless there's some regional standard that I'm unfamiliar with, currencies
(in fact, any numbers) are *always* grouped in threes. Otherwise the commas
are meaningless.

Steve

> -----Original Message-----
> From: david chan [mailto:david_tomcat@yahoo.com]
> Sent: August 14, 2003 9:12 AM
> To: Struts Users Mailing List
> Subject: RE: validation mask for currency
>
>
> Thanks. But the comma can be in anywhere in between
> first digit and the period.
>
> so this is valid also:
> 1,23,22
> 1234,2.3
>
> how to do that? (I am really new to regular
> expression)
>
> Thanks.
> David
>
> --- Yansheng Lin <ya...@isogis.com> wrote:
> > Try:
> > 	<field
> > 		property="xxxx" depends="mask"
> > 		<msg="mask"	key="xxx.displayname"/>
> > 		<var>
> > 			<var-name> mask</var-name>
> >
> >
> <var-value>^\d{1,3}(,?\d{3})*\.?(\d{1,2})?$</var-value>
> > 		</var>
> > 	</field>
> >
> > I tested your numbers, it seemed to work; but more
> > testing needed:).
> >
> >
> >
> > -----Original Message-----
> > From: david chan [mailto:david_tomcat@yahoo.com]
> > Sent: August 14, 2003 8:09 AM
> > To: Struts Users Mailing List
> > Subject: validation mask for currency
> >
> >
> > Hi,
> >  I need a regular expression for checking the dollar
> > among inputed by user (using validator struts 1.1
> > mask)
> >  Here are some valid money (comma and period are
> > allowed in specify location):
> >
> >  432,343.12
> >  212.12
> >  0.00
> >  1294
> >
> >  The max. value should be less than 9999999
> >
> >  Any regular expression expert can help?
> >
> > Thanks.
> > David
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site
> > design software
> > http://sitebuilder.yahoo.com
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> >
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: validation mask for currency

Posted by david chan <da...@yahoo.com>.
Thanks. But the comma can be in anywhere in between
first digit and the period.

so this is valid also: 
1,23,22
1234,2.3

how to do that? (I am really new to regular
expression)

Thanks.
David

--- Yansheng Lin <ya...@isogis.com> wrote:
> Try:
> 	<field 
> 		property="xxxx" depends="mask"
> 		<msg="mask"	key="xxx.displayname"/>
> 		<var>
> 			<var-name> mask</var-name>
> 		
>
<var-value>^\d{1,3}(,?\d{3})*\.?(\d{1,2})?$</var-value>
> 		</var>
> 	</field>
> 
> I tested your numbers, it seemed to work; but more
> testing needed:).		
> 
> 
> 
> -----Original Message-----
> From: david chan [mailto:david_tomcat@yahoo.com] 
> Sent: August 14, 2003 8:09 AM
> To: Struts Users Mailing List
> Subject: validation mask for currency
> 
> 
> Hi,
>  I need a regular expression for checking the dollar
> among inputed by user (using validator struts 1.1
> mask)
>  Here are some valid money (comma and period are
> allowed in specify location):
> 
>  432,343.12
>  212.12
>  0.00
>  1294
> 
>  The max. value should be less than 9999999
> 
>  Any regular expression expert can help?
> 
> Thanks.
> David
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> http://sitebuilder.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: validation mask for currency

Posted by Yansheng Lin <ya...@isogis.com>.
Try:
	<field 
		property="xxxx" depends="mask"
		<msg="mask"	key="xxx.displayname"/>
		<var>
			<var-name> mask</var-name>
			<var-value>^\d{1,3}(,?\d{3})*\.?(\d{1,2})?$</var-value>
		</var>
	</field>

I tested your numbers, it seemed to work; but more testing needed:).		



-----Original Message-----
From: david chan [mailto:david_tomcat@yahoo.com] 
Sent: August 14, 2003 8:09 AM
To: Struts Users Mailing List
Subject: validation mask for currency


Hi,
 I need a regular expression for checking the dollar
among inputed by user (using validator struts 1.1
mask)
 Here are some valid money (comma and period are
allowed in specify location):

 432,343.12
 212.12
 0.00
 1294

 The max. value should be less than 9999999

 Any regular expression expert can help?

Thanks.
David

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org