E
Edgardo Rossetto
Hi, I have something like:
string result = null;
try
{
string exp = @"(?'GroupName'<title>.*\(([0-9]{4})\).*</title>)";
Regex r = new Regex(exp);
result = r.Match(html).Groups["GroupName"].Value;
return result.Trim();
}
catch
{
return result;
}
The problem is that in theory GroupName should contain the result of the
expression, but instead it returns the entire thing, including the
<title> and </title> tags, however, r.Match(html).Groups[1].Value;
returns the proper content (the numbers).
What am I doing wrong?
Note I tried with 'GroupName' and <GroupName>, both valid ways to
identify the group name.
string result = null;
try
{
string exp = @"(?'GroupName'<title>.*\(([0-9]{4})\).*</title>)";
Regex r = new Regex(exp);
result = r.Match(html).Groups["GroupName"].Value;
return result.Trim();
}
catch
{
return result;
}
The problem is that in theory GroupName should contain the result of the
expression, but instead it returns the entire thing, including the
<title> and </title> tags, however, r.Match(html).Groups[1].Value;
returns the proper content (the numbers).
What am I doing wrong?
Note I tried with 'GroupName' and <GroupName>, both valid ways to
identify the group name.