Find number from a string

This regular expression will display if a string entered contains a number.

private void btnFindNumber_Click(object sender, System.EventArgs e)

Regex re = new Regex(@"\d+");
Match m = re.Match(txtFindNumber.Text);
if (m.Success)
lblResults.Text = string.Format("RegEx found " + m.Value + " at position " + m.Index.ToString());
lblResults.Text = "You didn't enter a string containing a number!";


Author: soniumesh21 Nov 2008 Member Level: Gold   Points : 0


This is Great and very use full for the devlopment.

Author: Syed Shakeer Hussain17 Dec 2008 Member Level: Gold   Points : 1


Deepika...Find number from a string Program you written well..Its good

Author: Pradeep Iyer18 Dec 2008 Member Level: Gold   Points : 0


Great code...

Thanks a lot

Pradeep Y

Author: Deepika Haridas03 Jun 2009 Member Level: Gold   Points : 1

Hello everyone,

Thanks for all your valuable comments..


Guest Author: Santhosh13 Feb 2013

Nice Madam..

Grate code. very easy to understand every one..

  • 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: