public static bool bb(string input)
{
string pattern = @"^(([A-Z]*|[a-z]*|/d*|[-_/~!@#/$%/^&/*/./(/)/[/]/{/}<>/?////'/"]*)|.{0,5})$|/s ";
Regex regex = new Regex(pattern);
return regex.IsMatch(input);
}
中间的patter就是你要的,用的时候就bb(textbox1.text)就行了
返回true 或者false