C# 正则表达式-20个字符长的数字,仅带空格
我在正则表达式上完全没用我需要做的是定义一个模式,允许一个至少5个字符的字符串,最多20个字符只允许空格和数字,不允许a-ZC# 正则表达式-20个字符长的数字,仅带空格,c#,regex,C#,Regex,我在正则表达式上完全没用我需要做的是定义一个模式,允许一个至少5个字符的字符串,最多20个字符只允许空格和数字,不允许a-Z 有什么想法吗?您可以使用以下正则表达式: @"^[\d ]{5,20}$" 说明: ^ # the beginning of the string [\d ]{5,20} # any character of: digits (0-9), ' ' (between 5 and 20 times) $ # befo
有什么想法吗?您可以使用以下正则表达式:
@"^[\d ]{5,20}$"
说明:
^ # the beginning of the string
[\d ]{5,20} # any character of: digits (0-9), ' ' (between 5 and 20 times)
$ # before an optional \n, and the end of the string
您可以使用以下正则表达式:
@"^[\d ]{5,20}$"
说明:
^ # the beginning of the string
[\d ]{5,20} # any character of: digits (0-9), ' ' (between 5 and 20 times)
$ # before an optional \n, and the end of the string
^[a-zA-Z]{5,20}$
应该可以使用。^[\sa-zA-Z]{5,20}$
字符是指字母还是也需要符号?这些链接可能会帮助您:只有数字和空格^[a-zA-Z]{5,20}$
应该可以使用。^[\sa-zA-Z]{5,20}$
字符是指字母还是需要符号,也可以吗?这些链接可能会帮助您:只有数字和空格