C#代码
public void a()
{
string str = "aaaa[bbbbbb]ccccc";
Regex reg = new Regex("[^/[/]/?/*]+");
Match m = reg.Match(str);
if(m.Success)
{
//
}
}
匹配演示(javascript版)
string strdoc = "dsdsd/";
bool exists = false;
string[] str = { "/","?","*","["," ]" };
for (int i = 0; i < str.Length; i++)
{
exists = strdoc.Contains(str[i]);
break;
}
if (exists)
{
strdoc = "包含特殊字符";//这里改你的操作
}
Console.WriteLine(strdoc);
Console.ReadLine();
Sorry看错了