I'm trying to count how many * symbols i have in my string. however im getting an error.
An unhandled exception of type 'System.ArgumentException' occurred in System.dll
I'm simply using a regex match to check it. When i tested with any other string it worked perfectly, but when i search for " * " it get's an exception.
Here's the code that gives expresion
string abc = "i am just trying *** for a sample code";
var count = Regex.Matches(abc, "*").Count;
Console.Out.WriteLine(count);
This one works perfectly
string abc = "i am just trying for a sample code";
var count = Regex.Matches(abc, "a").Count;
Console.Out.WriteLine(count);
Any Idea why ?