Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi all,

I want to use a regular expression statement in my asp.net 1.1 project to validate float numbers which can have ", . " as floating seperators. I am new in this topic, please help me.

Thanks in advance.
Posted

1 solution

try:
[+-]?\d+([\.\,]\d+)
 
Share this answer
 
Comments
kurtiniadiss 16-Nov-12 5:54am    
Thank you very much OriginalGriff it works perfectly for floating point numbers, but there is one more problem. I want integers to be included in this control, I forgot to add them into the question :(
MT_ 16-Nov-12 5:55am    
This regex should work for int as well. Did you try?
OriginalGriff 16-Nov-12 6:01am    
Um - it won't! :laugh:
MT_ 16-Nov-12 6:02am    
:-( . Yup requires ? or probably * will also do, right?
OriginalGriff 16-Nov-12 6:48am    
? - Yes.
* - No.
"*" would allow 1.2,2.2.2,2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900