I want to find out, whether my string contains a text like #1, #a, #abc, #123, #abc123dsds and so on... (\'#\' character with one or more characters (digits and letters).
Well this worked for me. \# checks if it starts with #, \w checks if it is a word.
class Program
{
static void Main(string[] args)
{
string text = "#2";
string pat = @"\#(\w+)";
Regex r = new Regex(pat);
Match m = r.Match(text);
Console.WriteLine(m.Success);
Console.ReadKey();
}
}