0

I would like to fetch values:

Data1
Data2
Data3

They will always be included in the <element> tag

string sample = "This is a email template" +
                "which containe <element>Data1</element>" +
                "and also this one <element>Data2</element>" +
                "dont forget this <element>Data3</element>";

var match = Regex.Match(sample, "<element>(.*)</element>");
foreach (var item in match.Groups)
{
    var found = item;
}

Loop executes twice with the following set of values:

1 => <element>Data1</element>and also this one <element>Data2</element>dont forget this <element>Data3</element>
2 => Data1</element>and also this one <element>Data2</element>dont forget this <element>Data3

Any idea, what I am missing here?

Shaggy
  • 5,422
  • 28
  • 98
  • 163

0 Answers0