Regex - распарсить баланс - C#
Формулировка задачи:
Приветствую всех имею кусок
Нужно спарсить баланс помогите составить выражение не получается ничего
<div>
<p class="balance_header">Ваш баланс:</p>
<p><b>0</b> руб.Решение задачи: «Regex - распарсить баланс»
textual
Листинг программы
using System;
using System.Text.RegularExpressions;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
string text = "<p class=\"balance_header\">Ваш баланс:</p><p><b>0</b> руб.";
string pattern = @"(?<=<b>)\d+";
Regex reg = new Regex(pattern);
MatchCollection matches = reg.Matches(text);
foreach(Match mat in matches)
{
Console.WriteLine("Баланс равен {0} руб.", mat.Value);
}
Console.ReadLine();
}
}
}