简体   繁体   中英

C# regex to match a number in fourth line

I'm new to C# regex. I haven't been able to match the number in the fourth line (including a blank line on third line) using C# regex:

 <th>Total Members</th>
 <td>

    87
 </td>
Match match = Regex.Match(input, @"<th>Total Members</th>\s*<td>\s*(\d+)\s*</td>", RegexOptions.Multiline);
if (match.Success)
{
    Console.WriteLine(match.Groups[1].Value);
}

尝试使用这个正则表达式

^[0-9]{2}$

It seems that your are going to parse html with regex.

I think you should use HTML Agility Pack instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM