Hi, I want to write a pattern like this, plase correct it.
I don't know how to add "@".Code:string key = "something";
string pattern = key + "[^\\d]+.*";
return Regex.IsMatch(string_value, pattern);
Thanks.
Printable View
Hi, I want to write a pattern like this, plase correct it.
I don't know how to add "@".Code:string key = "something";
string pattern = key + "[^\\d]+.*";
return Regex.IsMatch(string_value, pattern);
Thanks.
So you want to match a pattern that starts with "something", contains at least one character that is NOT a digit (and the @ sign?) and then matches the rest of the string?
If so, you are within a heartbeat of the solution:
Otherwise, I don't understand your question. Could you be more clear about what you want to do?Code:string key = "something";
string pattern = key + "[^\\d@]+.*"; //Change this line
return Regex.IsMatch(string_value, pattern);
I meanorCode:string pattern = key + "[^\\d]+.*";
orCode:string pattern = key + @"[^\\d]+.*";
I want to match a pattern that starts with "something", contains at least one character that is NOT a digit and then matches anything.Code:string pattern = key + @"[^\d]+.*";