I am trying to use a regular expression to isolate a number within a string. I would expect the following code to print 56, but it prints nothing. I am using Visual Studio 2010; I have also written other regular expressions and those work, so I assume it's an issue with my code. What am I doing wrong?
static void Main(string[] args)
{
string testString = "some alpha text 56 some more alpha text";
string resultString = null;
try
resultString = Regex.Match(testString, @"\d*").Value; // I have also tried [0-9]* with the same result
}
catch (ArgumentException ex)
Console.WriteLine(resultString);