Regular expression - C#
Формулировка задачи:
пример:
Как спарсить все TITLE-ы ?
string text = @"<title>TITLE</title>"+
"<title>TITLE1</title>"+
"<title>TITLE2</title>"+
"<title>TITLE3</title>"+
"<title>TITLE4</title>"+
"<title>TITLE5</title>"+
"<title>TITLE6</title>"+
"<title>TITLE7</title>"+
string match = Regex.Match(text, @"<title>(.*?)</title>").ToString();Решение задачи: «Regular expression»
textual
Листинг программы
string text = @"<title>TITLE</title>" +
"<title>TITLE1</title>" +
"<title>TITLE2</title>" +
"<title>TITLE3</title>" +
"<title>TITLE4</title>" +
"<title>TITLE5</title>" +
"<title>TITLE6</title>" +
"<title>TITLE7</title>";
var regExp = new System.Text.RegularExpressions.Regex(@"<title>(.*?)</title>");
var result = regExp.Matches(text);
foreach (Match item in result)
{
Console.WriteLine(item.Groups[1]);
}