<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>String extension method that uses regular expressions to determine if the string matches to a given regex pattern. Allows you to specify RegExOptions</Title>
      <Shortcut>Stringextensionmethodthatusesregularexpressionstodetermineifthestringmatchestoagivenregexpattern.AllowsyoutospecifyRegExOptions</Shortcut>
      <Description>String extension method that uses regular expressions to determine if the string matches to a given regex pattern. Allows you to specify RegExOptions [C#]</Description>
      <Author>John Tolar</Author>
      <HelpUrl>/PreviewSnippet.aspx?SnippetID=d2385698-782b-43aa-b78b-93e6e7661e3b</HelpUrl>
      <SnippetTypes>
        <SnippetType>SurroundsWith</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Code Language="csharp"><![CDATA[/// <summary>
        /// Uses regular expressions to determine if the string matches to a given regex pattern.
        /// </summary>
        /// <param name="value">The input string.</param>
        /// <param name="regexPattern">The regular expression pattern.</param>
        /// <param name="options">The regular expression options.</param>
        /// <returns>
        /// 	<c>true</c> if the value is matching to the specified pattern; otherwise, <c>false</c>.
        /// </returns>
        /// <example>
        /// <code>
        /// var s = "12345";
        /// var isMatching = s.IsMatchingTo(@"^\d+$");
        /// </code>
        /// </example>
        public static bool IsMatchingTo(this string value, string regexPattern, RegexOptions options)
        {
            return Regex.IsMatch(value, regexPattern, options);
        }]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>