I have an ASP.net string, and I am trying to extract ID from it. Here is the code:
public static string getName(string line)
{
string ret = "";
if (!line.Contains("ID="))
return ret;
var regex = new Regex("/.*ID=\".*?\".*/g");
if (regex.IsMatch(line))
ret = regex.Match(line).Groups[1].Value;
return ret;
}
And regex.IsMatch(line) always returns false.