using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\<p\s+?\/\>[ ]?";
string input = @"<?xml version=""1.0"" encoding=""utf-8""?>
<Data>
<Text number=""1"">
<Title>Lazy dog jumper</Title>
<Description><arg format=""x"" /><p /> The quick <p /> brown fox <p /> jumps <p /> over the <p /> lazy dog.<p />The quick brown fox jumps <p />over the lazy dog.<p /> The quick brown fox jumps over the lazy dog. <p /></Description>
</Text>
<Text number=""2"">
<Title>Lazy foxer</Title>
<Description>The quick brown fox <arg format=""x"" /><p />jumps <p>asdf</p> over the lazy dog <p /></Description>
</Text>
<Text number=""3"">
<Title>Quickest jumper</Title>
<Description>The quickest brown fox jumps over the lazy dog <p /> The slowest brown fox jumps over the laziest dog. <p /></Description>
</Text>
</Data>";
foreach (Match m in Regex.Matches(input, pattern))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx