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# 字母数字小写和小写需要正则表达式。及__C#_Regex - Fatal编程技术网

C# 字母数字小写和小写需要正则表达式。及_

C# 字母数字小写和小写需要正则表达式。及_,c#,regex,C#,Regex,我需要一个用于字母数字小写字符的正则表达式,另外它可以包括以下两个字符:和 字符串必须以字母数字小写字符开头和结尾 这些字符不能是连续的:。或。或。或。 示例: helloworlderrr✅ hello\uuu.errr✅ 。您好❌ 你好❌ hel_uuulo❌ 看看这个正则表达式: ^(?!.*(__|\.\.|_\._|\._\.))[a-z0-9][\w\.]+[a-z0-9]$ 看 如果你忘记了“连续”要求,你知道怎么做吗?@PM77-1我不知道该怎么做,所以你需要先学习regex

我需要一个用于字母数字小写字符的正则表达式,另外它可以包括以下两个字符:

字符串必须以字母数字小写字符开头和结尾

这些字符不能是连续的:

示例:

  • helloworlderrr
  • hello\uuu.errr
  • 。您好
  • 你好
  • hel_uuulo

      看看这个正则表达式:

      ^(?!.*(__|\.\.|_\._|\._\.))[a-z0-9][\w\.]+[a-z0-9]$
      


      如果你忘记了“连续”要求,你知道怎么做吗?@PM77-1我不知道该怎么做,所以你需要先学习regex基础知识。拿起你选择的教程。例如
      ^                            Start of string
      (?!.*(__|\.\.|_\._|\._\.))   Negative lookahead - do not match if contains __ /.. / _._ / ._.
      [a-z0-9]                     Match only lowercase alphanumeric
      [\w\.]+                      Match [a-zA-Z_] and dot
      [a-z0-9]                     Match only lowercase alphanumeric
      $                            End of string