using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"<svg\b[^>]* (viewBox=\""(\b[^""]*)\"").*?>([\s\S]*?)<\/svg>";
string input = @"<svg version=""1.1"" xmlns=""http://www.w3.org/2000/svg"" width=""28"" height=""32"" viewBox=""0 0 28 32""><title>guarantee</title><path fill=""#1a3347"" d=""M26.261 13.056v-6.823c-6.946 0.047-10.42-3.42-12.29-5.181-1.869 1.761-5.344 5.228-12.29 5.181v6.823c0 0-0.895 13.353 12.29 18.043 13.185-4.69 12.29-18.043 12.29-18.043z""></path><path fill=""#fff"" d=""M13.972 29.466l-0.202-0.081c-4.627-1.839-7.805-5.066-9.447-9.59-1.295-3.57-1.113-6.612-1.111-6.642l0.004-0.063-0.001-5.366 0.496-0.046c3.755-0.346 6.996-1.729 9.906-4.226l0.355-0.305 0.356 0.306c2.91 2.498 6.15 3.881 9.906 4.226l0.496 0.046 0.003 5.435c0.002 0.027 0.173 3.19-1.166 6.782-1.658 4.447-4.818 7.624-9.393 9.443l-0.202 0.080zM4.307 8.716l-0.005 4.512c-0.002 0.028-0.148 2.897 1.048 6.195 1.507 4.152 4.406 7.133 8.621 8.866 4.167-1.713 7.050-4.648 8.571-8.728 1.249-3.351 1.1-6.304 1.099-6.333l-0.004-0.068-0.001-4.442c-3.628-0.423-6.799-1.78-9.665-4.135-2.865 2.355-6.036 3.712-9.664 4.135z""></path></svg>";
RegexOptions options = RegexOptions.Multiline | RegexOptions.IgnoreCase;
foreach (Match m in Regex.Matches(input, pattern, options))
{
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