Ορίστε ένα παράδειγμα που εξάγει html tags από html κείμενο:
string input = "sample text <p>search text</p> sample text";
string expression = @"<(?<tag>\w*)>(?<text>.*)</\k<tag>>";
System.Text.RegularExpressions.MatchCollection matches;
matches = System.Text.RegularExpressions.Regex.Matches(input, expression);
foreach (System.Text.RegularExpressions.Match match in matches)
{
Console.WriteLine(match.Value);
}
Οι απαντήσεις παρέχονται για συγκεκριμένες ερωτήσεις και χωρίς καμιά εγγύηση. Διαβάστε επίσης τους όρους χρήσης.