<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Finds and extracts the title of HTML file with RegEx</Title>
      <Shortcut>FindsandextractsthetitleofHTMLfilewithRegEx</Shortcut>
      <Description>Finds and extracts the title of HTML file with RegEx [C#]</Description>
      <Author>Zepho Zep</Author>
      <HelpUrl>/PreviewSnippet.aspx?SnippetID=0f63482c-0271-4f6a-a91f-591a9abcd4f4</HelpUrl>
      <SnippetTypes>
        <SnippetType>SurroundsWith</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Code Language="csharp"><![CDATA[		/// <summary>
		/// Finds a title of HTML file. Doesn't work if the title spans two or more lines.
		/// </summary>
		/// <param name="html">HTML document.</param>
		/// <returns>Title string.</returns>
		private string getTitle(string html)
		{
			Match m = Regex.Match(html, "<title>(.*)</title>");
			if (m.Groups.Count == 2)
				return m.Groups[1].Value;
			return "(unknown)";
		}]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>