CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Regular Expressions

Print topic Send  topic

Author Message
Karim
Posted: 09/24/2003, 7:35 AM

I am trying to use Regular Expressions to validate a numeric field. I am using Javascript in my CCS page. The field has X.Y where X =>0 and X <=5 and Y is only 0 or 5 therefore having 1.0 or 1.5 or 1 or 2 or 2.0 or 2.5 etc.

I tried this pattern /^[0-5]+\.[05]*$/; if-you-will and it does not work, can anyone help.

Thanks,
Karim
DaveRexel
Posted: 09/24/2003, 3:03 PM

::
Hello Karim,

I tested your regexp in js code and it returned :

/^[0-5]+\.[05]*$/.test(1) = false;

/^[0-5]+\.[05]*$/.test(0.5) = true;

/^[0-5]+\.[05]*$/.test(1.0) = true;

/^[0-5]+\.[05]*$/.test(1.5) = true;

/^[0-5]+\.[05]*$/.test() = false;


ie your regexp has correct syntax

How are you using this in CCS and what error messages are shown?

Dave
Karim
Posted: 09/24/2003, 6:18 PM

Dave,

Yes, I guess the expression works, but my problem is I need it to work for whole number 0 1 2 3 4 5 which would include 0.5 1 1.5 2 2.5 etc.

Is that the right way to approach it?

Thanks,
Karim

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.