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).
My code so far won't work:
string test = "#123";
boolean matches = test.Contains("#.+");
The matches variable is false.
String.Containsdoes not accept a regex. UseRegex.IsMatch(test, "#.+").booleaninstead ofbool?[A-Za-z0-9]instead of., because as is you could simply use.startsWith("#")and.length > 1.