I have written regexes for recognizing float and int but they don't seem to work (code below).
{
string sumstring = "12.098";
Regex flt = new Regex(@" ^[0-9]*(\.[0-9]*)");
Regex ent = new Regex("^[0-9]+");
if (d_type.IsMatch(sumstring))
{
Console.WriteLine(sumstring + " " + "dtype");
}
Match m = ent.Match(sumstring);
if (m.Success)
{
Console.WriteLine("int");
}
else if (flt.IsMatch(sumstring))
{
Console.WriteLine("float");
}
}
Where is the mistake?