Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#Regex匹配不区分大小写的字符串';不包含某个字符串_C#_Regex_String_C# 6.0 - Fatal编程技术网

C#Regex匹配不区分大小写的字符串';不包含某个字符串

C#Regex匹配不区分大小写的字符串';不包含某个字符串,c#,regex,string,c#-6.0,C#,Regex,String,C# 6.0,我想匹配任何不包含字符串“None”的字符串(不区分大小写匹配) 我提出了这个问题 上述问题给出了区分大小写的解决方案,但我需要禁止使用字符串 “没有”在任何情况下 我需要一个通用正则表达式来禁止字符串(不区分大小写的匹配) 例如: 没有 没有 没有 没有 没有 没有 没有,等等 请帮助我…使用RegexOptions.IgnoreCase: Regex.Matches( text, @"^(?!.*None).*$", RegexOptions.IgnoreCase ); Regex.Is

我想匹配任何不包含字符串“None”的字符串(不区分大小写匹配)

我提出了这个问题

上述问题给出了区分大小写的解决方案,但我需要禁止使用字符串 “没有”在任何情况下

我需要一个通用正则表达式来禁止字符串(不区分大小写的匹配)

例如:

  • 没有
  • 没有
  • 没有
  • 没有
  • 没有
  • 没有
  • 没有,等等

请帮助我…

使用RegexOptions.IgnoreCase:

Regex.Matches( text, @"^(?!.*None).*$", RegexOptions.IgnoreCase );
Regex.IsMatch( text, @"^(?!.*None).*$" , RegexOptions.IgnoreCase );

使用RegexOptions.IgnoreCase:

Regex.Matches( text, @"^(?!.*None).*$", RegexOptions.IgnoreCase );
Regex.IsMatch( text, @"^(?!.*None).*$" , RegexOptions.IgnoreCase );

@GiladGreen-我正在通过正则表达式验证具有多个约束的字符串,这是子检查之一…@wiktor-请告诉我您的两个标记问题中哪一个是重复的。请注明任何一个问题是重复的。我急切地等待。@GiladGreen-我正在通过正则表达式验证具有多个约束的字符串,这是子检查之一…@wiktor-请告诉我您的两个标记问题中哪一个是重复的。请注明任何一个问题是重复的。我急切地等待着。