using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^[\#]$";
string input = @"
# Hello 54.217.223.119. Your session has been logged.<br />
#<br />
# Copyright (c) 2002 - 2014 by DK Hostmaster A/S<br />
# <br />
# The data in the DK Whois database is provided by DK Hostmaster A/S<br />
# for information purposes only, and to assist persons in obtaining<br />
# information about or related to a domain name registration record.<br />
# We do not guarantee its accuracy. We will reserve the right to remove<br />
# access for entities abusing the data, without notice.<br />
# <br />
# Any use of this material to target advertising or similar activities<br />
# are explicitly forbidden and will be prosecuted. DK Hostmaster A/S<br />
# requests to be notified of any such activities or suspicions thereof.<br />
Domain: dr.dk<br />
DNS: dr.dk<br />
Registered: 1998-03-11<br />
Expires: 2015-03-31<br />
Registration period: 1 year<br />
VID: no<br />
Status: Active<br />
Registrant<br />
Handle: D5109-DK<br />
Name: DR<br />
Address: DR-Byen, Emil Holms kanal 20<br />
Postalcode: 0999<br />
City: København C<br />
Country: DK<br />
Phone: +4535203661<br />
Administrator<br />
Handle: DH4991-DK<br />
Name: DR<br />
Attention: DR Hostmaster<br />
Address: DR-Byen, Emil Holms kanal 20<br />
Postalcode: 0999<br />
City: København C<br />
Country: DK<br />
Phone: +4535203660<br />
Nameservers<br />
Hostname: dns101.telia.com<br />
Handle: TA632-DK<br />
Hostname: dns102.telia.com<br />
Handle: TA632-DK<br />
Hostname: ns01.dr.dk<br />
Handle: DR3450-DK<br />";
RegexOptions options = 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