Click here to Skip to main content
13,342,442 members (50,711 online)
Rate this:
Please Sign up or sign in to vote.
See more: , +
Hi all,

I want to use a regular expression statement in my 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 15-Nov-12 23:40pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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 :(
Milind Thakkar 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:
Milind Thakkar 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
OriginalGriff 16-Nov-12 6:00am
Add a question mark to the end: that makes the last part optional with zero or one repetitions:
kurtiniadiss 16-Nov-12 6:23am
excellent! thank you so much:)
OriginalGriff 16-Nov-12 6:48am
You're welcome!

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180111.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100