if (strCoName == "Microsoft*"||"KingSoft*"||"Symantec*"||"Oracle*") 
 Console.WriteLine("You are using Standard software");
else
 Console.WriteLine("Hello,We are watching you! please do not enjoy games in work time! ");1)请问这段伪代码要怎么写?
2)可以用"*"通配符吗?

解决方案 »

  1.   

    using System.Text.RegularExpressions;
    用这个
    Regex.IsMatch("你的串","要找的串");返回bool
      

  2.   

    using System.Text.RegularExpressions;Regex r = new Regex("[Microsoft.*][KingSoft.*][Symantec.*][Oracle.*]");if (r.IsMatch(strCoName))
    {
        Console.WriteLine("You are using Standard software");
    }
    else
    {
        Console.WriteLine("Hello,We are watching you! please do not enjoy games in work time! ");
    }
      

  3.   

    Regex r = new Regex("[Microsoft.*][KingSoft.*][Symantec.*][Oracle.*]");
    这样定义是有问题的,经过挑灯夜战后,才找到应该这样写:   Regex r = new Regex("(Microsoft|Kingsoft|Symantec|Oracle).*");