Numeric text validation using regular expression Only !

in this article i will explain how to validate numeric text including dots combination using c# for example 4455.44.44. this number is not a valid number format because it should be formated like this ........

numeric text validation is so easy and it has been done before but many validations do not take into consideration the logical number combination
for example :
4455.44.44. is not a valid number for the reader but it should be formatted like this 445.544.44 or 445544.44
so i generated a regular expression that does this issue .and we can use @ using any language because regular expression is platform independent but am going to use C# and i will wait for any suggestions to make it better ,here is the code :

Regex _RegEx = new Regex(@"^\d*(\.+\d{3})*\.?\d+$|^\d*.?\d+$");
if (_RegEx.IsMatch(textBox1.Text))
MessageBox.Show("Match a numeric number");
MessageBox.Show("Does not match");

thanks alot
hope this helps


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: