string s = "Just a random string in C#.";
string pattern = @"(?i:\bC#\b)";
Match match = Regex.Match(s, pattern);
// Doesn't work
// I also tried:
// @"(?i:\bC\#\b)" escaping #
// @"(?i:\bC\u0023\b)" using unicode
// But same pattern works for any other alphabetical word
string pattern2 = @"(?i:\brandom\b)";
Match match2 = Regex.Match(s, pattern2);
string s = "Just a random string in C#.";
string pattern = @"(?i:\bC#\b)";
Match match = Regex.Match(s, pattern);
// Doesn't work
// I also tried:
// @"(?i:\bC\#\b)" escaping #
// @"(?i:\bC\u0023\b)" using unicode
// But same pattern works for any other alphabetical word
string pattern2 = @"(?i:\brandom\b)";
Match match2 = Regex.Match(s, pattern2);